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

Discussion in 'Java' started by Peter Bernhardt, Sep 18, 2003.

  1. 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
    Peter Bernhardt, Sep 18, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marian Veteanu

    AppBase and application directory

    Marian Veteanu, Oct 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    412
    Marian Veteanu
    Oct 18, 2004
  2. Guest
    Replies:
    2
    Views:
    3,891
    Kristofer Gafvert [MVP]
    Sep 8, 2005
  3. Replies:
    6
    Views:
    413
    S. Justin Gengo [MCP]
    Feb 10, 2006
  4. Sean Berry
    Replies:
    3
    Views:
    4,541
    Tim Terry
    Dec 19, 2005
  5. Andrew
    Replies:
    7
    Views:
    404
    Andrew
    Jun 28, 2009
Loading...

Share This Page