Struts2运行错误:Error filterStart

Struts2运行错误:

我的日志localhost.2012-08-24.log文件

2012-8-24 10:10:15 org.apache.catalina.core.ApplicationContext log

信息: ContextListener: contextInitialized()

2012-8-24 10:10:15 org.apache.catalina.core.ApplicationContext log

信息: SessionListener: contextInitialized()

2012-8-24 10:10:16 org.apache.catalina.core.StandardContext filterStart

严重: Exception starting filter struts2

java.lang.NullPointerException

       atcom.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)

       atorg.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(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

       at java.lang.reflect.Method.invoke(Unknown Source)

       at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

 

Tomcat后台报错:

 

严重: Error filterStart

2012-8-24 10:10:16 org.apache.catalina.core.StandardContext start

严重: Context [/Struts2_0400_Path] startup failed due to previous errors

2012-8-24 10:10:16 org.apache.catalina.loader.WebappClassLoader clearThreadLocal

Map

严重: The web application [/Struts2_0400_Path] created a ThreadLocal with key of

 type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony

.xwork2.inject.ContainerImpl$10@166c114]) and a value of type [java.lang.Object[

]] (value [[Ljava.lang.Object;@10e1513]) but failed to remove it when the web ap

plication was stopped. This is very likely to create a memory leak.

2012-8-24 10:10:16 org.apache.catalina.loader.WebappClassLoader clearThreadLocal

Map

严重: The web application [/Struts2_0400_Path] created a ThreadLocal with key of

 type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony

.xwork2.inject.ContainerImpl$10@509df8]) and a value of type [java.lang.Object[]

] (value [[Ljava.lang.Object;@b31a7c]) but failed to remove it when the web appl

ication was stopped. This is very likely to create a memory leak.

2012-8-24 10:10:17 org.apache.coyote.http11.Http11AprProtocol start

信息: Starting Coyote HTTP/1.1 on http-80

2012-8-24 10:10:17 org.apache.coyote.ajp.AjpAprProtocol start

信息: Starting Coyote AJP/1.3 on ajp-8009

2012-8-24 10:10:17 org.apache.catalina.startup.Catalina start

信息: Server startup in 2835 ms

 

解决方案一(我在CSDN论坛贴出问题后坛友解答):

1、你把核心的filter改成<filter-class> org.apache.struts2.dispatcher.FilterDispatcher</filter-class> 试试看看是否能够正常启动

2、恩,问题解决了,是因为我用的struts2.3.1版本,缺少一个jarcommon-lang,导入就好 了,不过纠结一整天算是找到了一个方法,就是在tomcat控制台看不到结果的时候,去tomcat/logs文件夹下看日志文件,结果发现

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
 
StringUtils
common-lang包中

 

3、

估计是包引用的事情
apache网站下载下来的包可能有问题
你找个能运行的例子,把你现在对应的lib下的包换下

 

4、

tomcat6.0+jdk1.6 项目中要放一下jar

struts2-core-2.2.1.

ar xwork-core-2.2.1.jar

ognl-3.0.jar  

javassist-3.7.ga.jar

freemarker-2.3.16.jar

commons-io-1.3.2.jar

commons-fileupload-1.2.1.jar

commons-logging-1.0.4.jar

 

 

 

 

其它解决方案:

 

1、试着把tomat/server/lib目录下的commons-digester.jar,commons-beanutils.jar拷贝到common/lib/目录  --经测试不行,tomcat5.5对应目录下根本没有对应的包。
2
、有个文章说tomcat里的bug,没有实现javax.servlet.FilterFilter会报这样的错误,看来tomcat在启动就初始化Filter实例,但是在filter中又没有看到那段代码没有实现Filter,或者有代码在启动时没有实例化。--没发现问题。

****************************************
问题解决了,将web.xml文件中filter配置删除重新写了一遍,然后将tomcat\common\lib\下的servlet-api.jar拷贝到tomcat\server\lib下,重新启动后就好了,也不知道与这个包有没有关系!

摘录总结下:
1
、如果以后出现tomcat 严重: Error filterStart 错误,一般原因为:1xml配置失误 2filter中某段代码未实例化(这个情况是出现最多的,要仔细检查) 3、试着把tomat/server/lib目录下的commons-digester.jar,commons-beanutils.jar拷贝到common/lib/目录,有些包在部署是没有被包含

 

开源中国论坛终曲解答:

这是tomcat6.0之后的内存检查机制,理论上换5.5重新部署应该没问题的,或者试试在server.xml里注释掉下面这句

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>

 

尝试方案三:

D:\Program Files\Tomcat6有空格

重装TomcatMyEclipse,消除安装路径空格问题:

 

D:\ProgramFiles\Tomcat6

 

 回复群友:

亲,上次关于struts2tomcat后台报错问题(http://topic.csdn.net/u/20120824/10/b04b46a5-eb73-4c31-b999-f1242f26f3a8.html)已解决:一怒之下,重新装MyEclipse/Tomcat6,发现……竟然可以了。估计是tomcat安装路径有空格问题、或者:链接:http://www.oschina.net/question/726248_67707

 

 

 重新部署、访问

访问路径:http://localhost/Struts2_0100_Introduction

Struts Problem Report

Struts has detected an unhandled exception:

Messages:

·  There is no Action mapped for namespace / and action name .

解决:

访问路径、NameSpaceAction命名/路径问题:

访问路径:http://localhost/Struts2_0100_Introduction/hell正确访问
至此,Game Over!!!

 

你可能感兴趣的:(tomcat,strtus2)