Results 1 to 3 of 3

Thread: Log4JConfigServlet unable to locate classpath:/META-INF/lo4j

Hybrid View

  1. #1

    Default Log4JConfigServlet unable to locate classpath:/META-INF/lo4j

    Since the 'classpath' feature became available, I have placed all my config files: applicationContext.xml, myapp-servlet.xml, views.xml, validator-rules.xml, validation.xml etc... under src/META-INF. If I specify a context parameter for log4j in web.xml, the config servlet seems to take the parameter literally and does not resolve it. Can you add this feature before spring 1.1 is released?
    Also, if the same is true for Hibernate i.e 'classpath' cannot be used in specifying the location of the mappingResources, can you add that feature as well?

    Thanks
    J2EEGuru,
    The Spring Advocate

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    Please file a feature request in Jira, as I can't see this making it in for 1.1, which is a day or two away. However, I don't necessarilly think it's a given that every class which takes a file path now needs to be updated to take the 'classpath:' prefix, to tell you the truth...

    Also, /META-INF is not a standard classpath location. What environment are you running that adds /META-INF to the classpath?

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3

    Default

    Actually, this is not a big deal. The feature would simply add consistency to my configuration. Here is what I mean:

    <!--web.xml-->

    <context-param>
    <param-name>log4jConfigLocation</param-name>

    <!--This does not work-->
    <!--<param-value>classpath:/META-INF/log4j.xml</param-value>-->

    <!--This will do for now provided that my app classes are not archived and they are placed in WEB-INF/classes-->
    <param-value>/WEB-INF/classes/META-INF/log4j.xml</param-value>
    <!--What if I archive my app classes into a jar and place it in WEB-INF/lib and META-INF (where all my config files including applicationContext.xml, log4j.xml, jsp 1.2 TLDs are) is now packaged in the app jar? How can I configure log4j.xml if I do not specify a 'classpath'?-->

    </context-param>
    <context-param>
    <param-name>log4jRefreshInterval</param-name>
    <param-value>10000</param-value>
    </context-param>

    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    classpath:/META-INF/applicationContext-resources.xml,
    classpath:/META-INF/applicationContext-dao.xml,
    classpath:/META-INF/applicationContext-service.xml,
    classpath:/META-INF/applicationContext-validation.xml
    </param-value>
    </context-param>

    <servlet>
    <servlet-name>log4j</servlet-name>
    <servlet-class>org.springframework.web.util.Log4jConfigServ let</servlet-class>
    <load-on-startup>0</load-on-startup>
    </servlet>

    <servlet>
    <servlet-name>context</servlet-name>
    <servlet-class>org.springframework.web.context.ContextLoade rServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet>
    <servlet-name>myapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/META-INF/myapp-servlet.xml</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    J2EEGuru,
    The Spring Advocate

Similar Threads

  1. Replies: 32
    Last Post: Jul 20th, 2006, 01:37 PM
  2. Beandoc crashing (on its samples!)
    By aaime in forum Container
    Replies: 17
    Last Post: Oct 7th, 2005, 07:21 AM
  3. Unable to locate MessageSource
    By fracca in forum Web
    Replies: 2
    Last Post: Jan 24th, 2005, 12:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •