Announcement Announcement Module
Collapse
No announcement yet.
Exception while loading Log4jConfigListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception while loading Log4jConfigListener

    Hi,

    I am trying to setup log4j logging mechanism in Spring application. I am using Spring listener i.e. Log4jConfigListener to configure log4j while server startup. I am deploying Maven created .war file manually on Weblogic 10.3 local server. Here is what I have in my web.xml file.


    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
    </listener>

    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>

    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>myapp.root</param-value>
    </context-param>



    Since Log4jConfigListener is ServletContextListener, I am getting following exception while application startup:




    <HTTP> <BEA-101162> <User defined listener org.springframework.web.util.Log4jConfigListener failed: java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded.
    java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded
    at org.springframework.web.util.WebUtils.setWebAppRoo tSystemProperty(WebUtils.java:139)
    at org.springframework.web.util.Log4jWebConfigurer.in itLogging(Log4jWebConfigurer.java:118)
    at org.springframework.web.util.Log4jConfigListener.c ontextInitialized(Log4jConfigListener.java:47)
    at weblogic.servlet.internal.EventsManager$FireContex tListenerAction.run(EventsManager.java:465)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)


    I have tried deploying the same war file on Tomcat and it works fine but it is not working with Weblogic 10.3.

    Please do let me know if I am doing something wrong with this configuration. Also please let me know if there is any other way to configure log4j Logging mechanism with Spring.

    Thanks,
    Mahesh

  • #2
    are you sure you need to add the listener to your web.xml file ??

    Have a look at that thread:
    http://osdir.com/ml/java.springframe.../msg00344.html

    hope that helps

    Comment

    Working...
    X