MyEclipse8.0開發SSH問題集錦

刪除MyEclipse下lib中jar包的步驟:
1) 進入服務器路徑中的lib目錄下,直接刪除。
2) 右鍵lib->構建路徑->配置構建路徑->選擇上面的三個包點擊“除去”按扭
3) 在myeclipse中右鍵直接刪除lib中的三個衝突包,徹底刪除,在lib中不再顯示
4) 重新啓動tomcat服務器

異常1:

Exception starting filter struts2
java.lang.ClassNotFoundException: 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterat 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4038) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4692)at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1385)at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638) at java.lang.Thread.run(Thread.java:619)

問題根源:通過myeclipse自動添加的包,導致struts2與spring有衝突,即Struts2的3個包asm.jar、asm.attrs.jar、cglib-2.1-3.jar與Spring2.5的四個包asm-2.2.3.jar、asm-commoms-2.2.3.jar、asm-util-2.2..3.jar、cglib-nodep-2.1-3.jar衝突。

解決方法:在lib中刪除Struts2的3個包asm.jar、asm.attrs.jar、cglib-2.1-3.jar,並刷新lib即可。

異常2:

Illegal access: this web application instance has been stopped already.  Could not load java.net.BindException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)	at com.mysql.jdbc.CommunicationsException.<init>(CommunicationsException.java:155)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2757)
	at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2650)
	at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:1366)
	at com.mysql.jdbc.Connection.realClose(Connection.java:4475)
	at com.mysql.jdbc.Connection.cleanup(Connection.java:1975)
	at com.mysql.jdbc.Connection.finalize(Connection.java:3124)
	at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
	at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
	at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)


問題根源: MySQL 的 JDBC 驅動放在應用的 WEB-INF\lib 目錄下,在重新發布時其加載了兩次
解決方法:將 MySQL 的JDBC驅動文件刪除,然後將JDBC驅動從 WEB-INF\lib 文件夾中移動到 %TOMCAT_HOME%\lib 中。

異常3:

Exception starting filter struts2
Unable to load configuration. - [unknown location]
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
	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:4038)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4692)
	at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3428)
	at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1357)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1649)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1658)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1638)
	at java.lang.Thread.run(Thread.java:619)
Caused by: Unable to load configuration. - [unknown location]
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
	... 15 more
Caused by: Caught exception while loading file struts-default.xml - [unknown location]
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:902)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:143)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:110)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:168)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
	... 17 more
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
	at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.createDocument(SAX2DOM.java:326)
	at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:85)
	at com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory.getSerializationHandler(TransletOutputHandlerFactory.java:187)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:392)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:137)
	at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.setup(DomHelper.java:205)
	at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:190)
	at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:181)
	at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:167)
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:107)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893)
	... 21 more


問題根源:真正原因不是JDK 6和Struts 2衝突, 而是 MyEclipse Hibernate 類庫中多了兩個包: xml-apis.jar和xerces-2.6.2.jar, 這兩個包的功能和JDK的衝突了。

解決方法:1. 刪除發佈後的目錄下的WEB-INF\lib下的xml-apis.jar和xerces-2.6.2.jar; 並停止Tomcat,重新啓動就可以,不需要再次發佈

                    2. 或者使用JDK 1.5來啓動Tomcat 6.

異常4:

嚴重: The web application [/dhulab] appears to have started a thread named [Timer-2] but has failed to stop it. This is very likely to create a memory leak.
2012-7-11 20:56:43 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
嚴重: The web application [/dhulab] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1bce12f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@163d693]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2012-7-11 20:56:43 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
嚴重: The web application [/dhulab] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1bce12f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1d27ad0]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2012-7-11 20:56:43 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
嚴重: The web application [/dhulab] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1bce12f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@17d0530]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

問題根源及解決方法:

參考網址:https://confluence.atlassian.com/pages/viewpage.action?pageId=218275753

There is a memory leak detection feature introduced in Tomcat 6.0.25 that attempts to log objects that have failed to be unregistered by webapps it hosts when they are stopped, and were forcibly unregistered by Tomcat. As Tomcat is forcibly removing these objects, it is not a serious concern that these log messages occur.

These errors will also appear during startup if your JDBC driver is not in the correct location on startup. If you are using a datasource, be sure to copy the JDBC drive to<confluence-install>/lib. If the issue persists, verify that you are able to authenticate against your database with the credentials supplied in your<confluence-home>/confluence.cfg.xml in the Hibernate connection settings.

Despite their apparent severity, these log messages are benign and can be safely ignored.

As of writing, the solution is to downgrade. Users can install Tomcat 6.0.20 as a workaround.

Tomcat 6.0.26 does NOT fix Confluence Deadlocks when Running under Tomcat 6.0.24.

This workaround is not recommended as Tomcat 6.0.20 has known performance issues, and has severalsecurity vulnerabilities. We recommend customers upgrade to (or continue to run) Tomcat 6.0.32 or higher.

 

其他:

Ognl訪問靜態方法:

struts.ognl.allowStaticMethodAccess=true

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章