How to find the appbase directory from inside a tomcat-webapp

P

Peter Bernhardt

Hi NG,

my application needs to know the complete path to the tomcat host's
appbase directory to read params in the context.xml file stored there
and I don't know how to find it.
Ok I can find the tomcat home with System.getProperty("catalina.base")
but additionaly I need the subdirectory name defined in appbase=... of
the <host> paragraph in tomcat's server.xml.
Ok I could read this server.xml but there are things I can't (or will
not) expect from a tomcat installation:
- that the server.xml is stored in %tomcat home%\conf
- that this server.xml contains only 1 <host> paragraph and if there
are more than 1 which of them belongs to my webapp?
- that the appbase directory is a subdirectory of %tomcat home%
Therefore my question:
please can somebody give me an idea how to get this path.

MTA
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top