问题描述:在开发过程中lib里引用了struts2.0.1.6包后启动tomcat发现一个bug:
Exception starting filter struts2
java.lang.NullPointerException
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.ng.InitOperations.initStaticContentLoader(
InitOperations.java:77)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(
StrutsPrepareAndExecuteFilter.java:49)
at
org.apache.catalina.core.ApplicationFilterConfig.(
ApplicationFilterConfig.java:115)
at
org.apache.catalina.core.ContainerBase.addChildInternal(
ContainerBase.java:799)
at
org.apache.catalina.startup.HostConfig.deployDirectory(
HostConfig.java:1079)
at
org.apache.catalina.startup.HostConfig.deployDirectories(
HostConfig.java:1002)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
LifecycleSupport.java:142)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2014-1-1 19:17:33
org.apache.catalina.core.StandardContext start
网上有多种说法:大多数提到时tomcat的安装目录有空格造成的,其实bug本质上是来自于struts2自身的bug
解决之道:1、换一个新版本的包呗!才发现当你换新包时有会出现很多无法预料的问题(今天浪费哥近3小时)
2、直接把tomcat安装路径放到一个新建文件夹下,这次可不许对新建文件夹命名有空格了。。。。泪奔啊,浪费哥的时间