Struts2運行錯誤:Error filterStart

Struts2運行錯誤:

個人日誌localhost.2012-08-24.log文件html

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

信息: ContextListener: contextInitialized()web

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

信息: SessionListener: contextInitialized()api

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

嚴重: Exception starting filter struts2app

java.lang.NullPointerExceptionide

       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!!!

相關文章
相關標籤/搜索