How to avoid NullPointerException in WebappClassLoader.findResources?
When redeploying a specific webapp by using the manager-app, the next call causes a 'NullPointerException' because of WebappClassLoader.findResources (Stacktrace below). After restarting the tomcat the app will running smooth.
Looking all over the web, the problem seems to be a very common, but without a concrete solution. For me it's only caused when deploying one specific webapp. Related to some mailinglists it could be a jar (e.g. axis.jar) which is include in shared/libs/ but not should be in /WEB-INF/libs/
For building and deploying the webapp I use maven and开发者_如何学运维 it works fine for all other apps, but this one. There are no differences in the projekt configuration of this project and the other ones.
May there are some things I could do to find the reason why the tomcat "crashs"?! Someone have any ideas resolving this issue?!
java.lang.NullPointerException
at org.apache.catalina.loader.WebappClassLoader.findResources(WebappClassLoader.java:1245)
at java.lang.ClassLoader.getResources(ClassLoader.java:1041)
at org.apache.commons.discovery.jdk.JDK12Hooks.getResources(JDK12Hooks.java:150)
at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResources(DiscoverResources.java:153)
at org.apache.commons.discovery.resource.DiscoverResources$1.getNextResource(DiscoverResources.java:129)
at org.apache.commons.discovery.resource.DiscoverResources$1.hasNext(DiscoverResources.java:116)
at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassNames(DiscoverNamesInFile.java:186)
at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.getNextClassName(DiscoverNamesInFile.java:170)
at org.apache.commons.discovery.resource.names.DiscoverNamesInFile$1.hasNext(DiscoverNamesInFile.java:157)
at org.apache.commons.discovery.resource.names.NameDiscoverers$1.getNextIterator(NameDiscoverers.java:143)
at org.apache.commons.discovery.resource.names.NameDiscoverers$1.hasNext(NameDiscoverers.java:126)
at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.getNextResource(ResourceClassDiscoverImpl.java:159)
at org.apache.commons.discovery.resource.classes.ResourceClassDiscoverImpl$1.hasNext(ResourceClassDiscoverImpl.java:147)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:120)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)
at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
I've seen this problem occur when including commons-discovery.jar in your Tomcat/lib folder.
If you are using commons-discovery.jar for a project specific purpose, put it in the WEB-INF/lib folder of your project and not the Tomcat/lib folder, this should resolve your issue.
It's a deployment problem, not a Tomcat problem.
It happened to me today and it was because of not having saaj.jar in the WEB-INF/lib.
精彩评论