Hi ng,
I've been having some serious problems using Log4J on tomcat. We're actually using Sun One 7 but its actually bundled with tomcat.
So, the problem i've been having is in trying to properly shutdown log4j, if i try to redeploy on a running server i get a bind exception from log4j not being cleaned up and the port being closed, here's the exception:
I'm using the Log4jConfigListener but it seems unable to close log4j. I think there is some problem with tomcat not cleaning up the classloader and static references sticking around after the web app has been undeployed. Has anyone come accross a similar problem or have any idea on how i can work around this?Code:[20/Dec/2004:10:03:22] INFO ( 168): CORE3276: Installing a new configuration [20/Dec/2004:10:03:22] INFO ( 168): WEB0100: Loading web module [webtest] in virtual server [server1] at [/webtest] [20/Dec/2004:10:03:24] WARNING ( 168): CORE3283: stderr: log4j:ERROR exception setting timeout, shutting down server socket. [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: java.net.BindException: Address already in use: JVM_Bind [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.net.PlainSocketImpl.socketBind(Native Method) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.net.ServerSocket.bind(ServerSocket.java:318) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.net.ServerSocket.<init>(ServerSocket.java:185) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.net.ServerSocket.<init>(ServerSocket.java:97) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at org.apache.log4j.net.SocketHubAppender$ServerMonitor.run(SocketHubAppender.java:315) [20/Dec/2004:10:03:25] WARNING ( 168): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
Also on a different point there is another problem when i try to redeploy in sunone 7 using the Log4jConfigListener, for some reason the webAppRootKey context parameter is not removed so when a new deployement is deployed and exploded into a new unique directory by sunone it throws an exception about the name already being in use. Any suggestions?
btw heres the test web.xml:
thanks,Code:<web-app> <display-name>WebTest</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value> </param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/classes/log4j.properties</param-value> </context-param> <context-param> <param-name>webAppRootKey</param-name> <param-value>webtest.root</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> </web-app>
cam[/code]


Reply With Quote