Tomcat can't find log4j properties file in war file

Discussion in 'Java' started by Jim, Jan 19, 2004.

  1. Jim

    Jim Guest

    I have a web app served by Tomcat on a Unix system which I have been running
    out the development environment. I am trying to deploy it as a jar file.
    When the log4j logging system starts up it says it cannot find the
    properties file in the war file.

    Do I have to specify the properties file location differently?

    More detailed information is below.
    Any suggestions will be greatly appreciated; I thank you in advance for your
    help

    Jim Cant

    At startup, Tomcat loads a servlet to initialize the log4j logging system;
    the name of an initialization file is given in the servlet element in the
    web.xml file:
    <param-value>hspLog4j.properties</param-value>
    The log file is located in the directory 'docBase' in server.xml, specified
    with an absolute path:
    <Context path="/HSP" docBase="/home/jcant/HSP/WebApp" .....
    This works fine and logging gets initialized.

    However, when I jar up the development into HSP.war and point Tomcat at it,
    the properties file is not found.
    I change server.xml so docBase="HSP.war" and also set 'appbase' to point to
    "webapps".

    When Tomcat is restarted, the web app runs fine out of the war file but the
    logging never gets initialized. The log file has the error message
    log4j:ERROR Could not read configuration file
    [hspLog4j.properties].
    java.io.FileNotFoundException: hspLog4j.properties (No
    such file or directory)
    at java.io.FileInputStream.open(Native
    Method)
    .....
    The properties file is in the root of the war file which is the
    corresponding place to the 'WebApp' directory when running from the
    development environment.

    When I look in $TOMCAT_HOME/work/Standalone/localhost/HSP, I see the WEB-INF
    directory and subdirectories has been deployed but no other files in the war
    file are there.
    Jim, Jan 19, 2004
    #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. Rodolfo
    Replies:
    0
    Views:
    946
    Rodolfo
    Jul 12, 2004
  2. John
    Replies:
    3
    Views:
    3,598
  3. willirl
    Replies:
    3
    Views:
    688
    Sebastian Millies
    Feb 24, 2005
  4. Ramkumar Kaleeswaran
    Replies:
    1
    Views:
    439
    Andrea Desole
    Dec 8, 2005
  5. Gianni Galore
    Replies:
    0
    Views:
    1,255
    Gianni Galore
    Sep 8, 2010
Loading...

Share This Page