Announcement Announcement Module
Collapse
No announcement yet.
Log4JConfigServlet unable to locate classpath:/META-INF/lo4j Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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,

    Comment


    • #3
      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>

      Comment

      Working...
      X