struts配置_开发模式不能再tomcat安装路径有空格的情况下使用

  1. 今天尝试整合SSH,发现struts.xml中,写有开发模式的选项
  2. <constant name="struts.devMode" value="true"/> 或者
    <constant name="struts.configuration.xml.reload" value="true"/>

    时,如果tomcat的安装路径中有空格的情况下 (我出错是因为装在program files目录下),部署会出现如下错误:

  3. org.apache.catalina.core.StandardContext filterStart   
  4. 严重: Exception starting filter struts2   
  5. java.lang.NullPointerException   
  6.      at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)   
  7.      at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)   
  8.      at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)   
  9.      at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)   
  10.      at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)   
  11.      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)   
  12.      at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)   
  13.      at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191)   
  14.      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)   
  15.      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)   
  16.      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)   
  17.      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)   
  18.      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)   
  19.      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)   
  20.      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)   
  21.      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)   
  22.      at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)   
  23.      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)   
  24.      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)   
  25.      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)   
  26.      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)   
  27.      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)   
  28.      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)   
  29.      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)   
  30.      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)   
  31.      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)   
  32.      at org.apache.catalina.core.StandardService.start(StandardService.java:516)   
  33.      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)   
  34.      at org.apache.catalina.startup.Catalina.start(Catalina.java:578)   
  35.      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   
  36.      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)   
  37.      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   
  38.      at java.lang.reflect.Method.invoke(Method.java:597)   
  39.      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)   
  40.      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)   
  41. 2009-2-4 22:40:54 org.apache.catalina.core.StandardContext start   
  42. 严重: Error filterStart   
  43. 2009-2-4 22:40:54 org.apache.catalina.core.StandardContext start   
  44. 严重: Context [/Struts2Demo2] startup failed due to previous errors  

如果要修复此错误:
     1. 不使用开发模式
     2. 改变tomcat的安装路径,消除空格

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

觉得这个解释有些牵强, 不知谁有更好的解释提出呢?

你可能感兴趣的:(tomcat,exception,struts,ssh,filter)