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

 


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