Struts2.1.6的开发模式问题

    使用Struts2.1.6,如果设为开发模式,即

    <constant name="struts.devMode" value="true"/> 或者
    <constant name="struts.configuration.xml.reload" value="true"/>

    启动Tomcat时,会出现以下异常:

严重: 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:295)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	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:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2014-7-4 16:44:13 org.apache.catalina.core.StandardContext start
严重: Error filterStart

 

    解决办法:

    1、错误具体原因应该是因为tomcat的路径中包含了空格 tomcat 的解压路径中不能包含空格,刚开始我的

         路径是在D://Program Files\tomcat6;其中Program Files之间有空格,之后我把tomcat单独切出来放到  

         D://tomcat/tomcat6/之后问题解决。

    2、把<constant name="struts.devMode" value="true" />此配置去掉即可

         原因:devMode模式是开发模式,开启它则默认开启了i18n.reload、 configuration.xml.reload。这个

                   错误是由于configuration.xml.reload设置为true导致的。

你可能感兴趣的:(Struts2.1.6的开发模式问题)