Exception starting filter struts2 java.lang.NullPointerException

 Exception starting filter struts2
java.lang.NullPointerException
 at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)
 at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)
 at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)
 at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)
 at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)
 at org.apache.struts2.dispatcher.ng.InitOperations.initStaticContentLoader(InitOperations.java:77)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:49)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 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:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2011-4-21 1:36:21 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-4-21 1:36:21 org.apache.catalina.core.StandardContext start
严重: Context [/autoffice] startup failed due to previous errors

 

先看看你的struts.xml配置文件里面有没有配置

 

<!-- 开发模式 -->
 <constant name="struts.devMode" value="true" />
 <!-- 当修改配置文件不需要重启服务,开发比较有用 -->
 <constant name="struts.configuration.xml.reload" value="true" />

 

删掉重启就ok!试试吧

原因是: devMode模式是开发模式,开启它则默认开启了i18n.reload、configuration.xml.reload。这个错误是由于configuration.xml.reload设置为true倒置的, 原因很简单,tomcat的安装路径包含空格

 

但你也可以把tomcat安装目录里的 空格删了就行了

file:/D:/Tomcat%205.5/Tomcat%205.5/webapps/autoffice/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class

 

看见'%20'说明安装的时候tomcat安装的时候有空格你去掉就可以!

 

去掉tomcat安装目录的空格就可以正常启动

file:/D:/Tomcat5.5/Tomcat5.5/webapps/autoffice/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class

你可能感兴趣的:(java,apache,tomcat,xml,struts)