The following Exception was thrown: java.lang.NullPointerException at org.apache.catalina.startup.HostConfig.deployDescriptors (HostConfig.java:490) A first analyse of source code: protected void deployDescriptors(File configBase, String[] files) the "files[]" parameter might be null, but is not tested on null in body of method. The calling functions also don't check for a null array. Simple solution would be: use: protected void deployDescriptors(File configBase, String[] files) { if (!deployXML || files==null) return; [...] instead of: protected void deployDescriptors(File configBase, String[] files) { if (!deployXML) return; [...] In all cases i found the calling methods use the File.list() mtehod to create array without check, but according to J2SE API Doc "null" is allowed as return value of "list()", so a check might make sense.
After taking a deeper look into source code, there are several more points where the files list is not checked against null values.
The NPE is actually blocking the whole Tomcat, because of infinite number of exceptions (s. log). So could someone please commit the patch I provided earlier. It's just simple null value checking. Thanks, Sascha from LOG: 25.06.2004 10:06:58 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren SCHWERWIEGEND: Exception invoking periodic operation: java.lang.NullPointerException at org.apache.catalina.startup.HostConfig.deployDescriptors (HostConfig.java:445) at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:427) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1064) at org.apache.catalina.startup.HostConfig.lifecycleEvent (HostConfig.java:327) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardHost.backgroundProcess (StandardHost.java:800) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1619) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1628) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run (ContainerBase.java:1608) at java.lang.Thread.run(Thread.java:534) 25.06.2004 10:06:58 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren SCHWERWIEGEND: Exception invoking periodic operation: java.lang.NullPointerException at org.apache.catalina.startup.HostConfig.deployDescriptors (HostConfig.java:445) at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:427) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1064) at org.apache.catalina.startup.HostConfig.lifecycleEvent (HostConfig.java:327) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardHost.backgroundProcess (StandardHost.java:800) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1619) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1628) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run (ContainerBase.java:1608) at java.lang.Thread.run(Thread.java:534) 25.06.2004 10:06:58 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor processChildren SCHWERWIEGEND: Exception invoking periodic operation: java.lang.NullPointerException at org.apache.catalina.startup.HostConfig.deployDescriptors (HostConfig.java:445) at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:427) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1064) at org.apache.catalina.startup.HostConfig.lifecycleEvent (HostConfig.java:327) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java:119) at org.apache.catalina.core.StandardHost.backgroundProcess (StandardHost.java:800) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1619) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild ren(ContainerBase.java:1628) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run (ContainerBase.java:1608) at java.lang.Thread.run(Thread.java:534) i
Hey, I have made a patch to fix some NPE risks. also this patch include the xml.mkdir fix. http://issues.apache.org/bugzilla/show_bug.cgi?id=29038 regards peter
Created attachment 11947 [details] HostConfig
As mentioned before the NPE is blocking the tomcat, it's even impossible to shut down the server: Catalina.stop: java.net.SocketException: Broken pipe java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:115) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:414) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:333) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:424) The server shuts down normally if the NPE is not in the log-file, whenever the NPE is in the logs, the shutdown script failed with above exception (no need to tell me something about killing processes). I would really appreciate if the patch could be applied and committed. Any reason why this didn't happen ? If there are any concerns, could you please tell me ? -Sascha
Hey, here my HostConfig.class. copy to server/classes/org/apache/catalina/startup regards peter
Created attachment 12026 [details] HostConfig with NPE und XML.mkdirs Patch
*** Bug 30331 has been marked as a duplicate of this bug. ***
*** Bug 30249 has been marked as a duplicate of this bug. ***
*** Bug 30462 has been marked as a duplicate of this bug. ***
Patch applied in TOMCAT_5_0 branch as suggested here. Modified portions applied on CVS HEAD as HostConfig on HEAD has already been significantly modified for Tomcat 5.5.
*** Bug 30899 has been marked as a duplicate of this bug. ***