Exception starting filter struts2

web.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
   
   <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

 

struts.xml配置:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>
 <constant name="struts.devMode" value="true" />
    <constant name="struts.i18n.encoding" value="UTF-8"/>
   
    <package name="login" namespace="/" extends="struts-default">
     
     <action name="login">
      <result>/login.jsp</result>
     </action>
    </package>
</struts>

 

如上配置造就如下错误:

 

2012-2-12 16:32:19 org.apache.catalina.startup.HostConfig checkResources
信息: Reloading context [/yafeng]
2012-2-12 16:32:19 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [/yafeng] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1b88891]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@df4c8]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider).
log4j:WARN Please initialize the log4j system properly.
2012-2-12 16:32:22 org.apache.catalina.core.StandardContext filterStart
严重: 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.initFilter(ApplicationFilterConfig.java:273)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4584)
 at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5262)
 at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5257)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
2012-2-12 16:32:22 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2012-2-12 16:32:22 org.apache.catalina.core.StandardContext startInternal
严重: Context [/yafeng] startup failed due to previous errors

 

解决之道:

很简单的问题,struts2与tomcat的问题,你把<constant name="struts.devMode" value="true" />中的value值改为false也一样可以的,因为devMode模式是开发模式,开启它则默认开启了i18n.reload、configuration.xml.reload。这个错误是由于configuration.xml.reload设置为true造成的,这个错误在apach官方中有说明的

 

 

转载于:https://www.cnblogs.com/nieshanfeng/archive/2012/02/12/2348063.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值