转自刘长炯的博客:http://www.blogjava.net/beansoft/archive/2008/10/13/233962.html

MyEclipse 6开发JDK6和Struts 2冲突的问题真实原因及解决办法

前一阵子在讲解一个SCM的Demo项目, 用Struts 2+Hibernate开发. 再次遇到了 Struts 2+JDK 6的冲突问题.

出错信息: Illegal access: this web application instance has been stopped already. Could not load org.xml.sax.SAXException. 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:1244)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)

at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:69)

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:213)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:198)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:189)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:175)

at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)

at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)

at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)

at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3086)

at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:912)

at org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:523)

at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:113)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)

at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)

at java.lang.Thread.run(Thread.java:619)

2008-9-19 0:08:34 org.apache.catalina.core.StandardContext filterStart

严重: Exception starting filter struts2

Caught exception while loading file struts-default.xml - [unknown location]

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:839)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)

at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)

at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)

at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3086)

at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:912)

at org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:523)

at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:113)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)

at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)

at java.lang.Thread.run(Thread.java:619)

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.<init>(SAX2DOM.java:69)

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:213)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:198)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:189)

at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:175)

at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)

... 31 more

2008-9-19 0:08:34 org.apache.catalina.core.StandardContext start

现象: 第一次能运行, reload就不行. 启动不行.

解决思路: 排除法.

先试了Struts2自带的blank包, 没问题.

那基本可断定是其他jar包有冲突, 应该是XML解析包有冲突.

检查发布后的WEB-INF/lib有两个XML解析包: xml-apis.jar和xerces-2.6.2.jar

这种错误真正原因不是JDK 6和Struts 2冲突, 而是 MyEclipse Hibernate 类库中多了两个包: xml-apis.jar和xerces-2.6.2.jar, 这两个包的功能和JDK的冲突了. 解决办法: 1. 删除发布后目录的 WEB-INF/lib/ 下的这两个文件; 2. 或者使用JDK 1.5来启动Tomcat 6.

方案1的详细操作步骤:

a. 先把MyEclipse Hibernate 3.2 Core Lib从BuildPath去掉;

b. 不要重新发布应用, 从发布后的目录复制全部的jar文件到开发工具下项目的WEB-INF\lib目录下, 不要复制其中的xml-apis.jar和xerces-2.6.2.jar.

c. 停止Tomcat, 重新发布应用或者删除发布后的目录下的WEB-INF\lib下的xml-apis.jar和xerces-2.6.2.jar.

小提示: MyEclipse 自带类库有很多问题, 建议读者自行下载官方网站jar包进行开发, 比较保险.

转自:http://lcyhunter02.blog.163.com/blog/static/9140527220089202372867/

Caught exception while loading file struts-default.xml 的错误的更多相关文章

  1. Caught exception while loading file struts-default.xml 错误

    严重: Exception starting filter struts2 Caught exception while loading file struts-default.xml - [unkn ...

  2. 报错: WARN hdfs.DFSClient: Caught exception java.lang.InterruptedException

    WARN hdfs.DFSClient: Caught exception java.lang.InterruptedException 而且日志中没有错误. 官网语句:$ bin/hdfs dfs ...

  3. 启动azkaban时出现User xml file conf/azkaban-users.xml doesn't exist问题解决(图文详解)

      问题详情 [hadoop@master azkaban]$ ll total drwxrwxr-x hadoop hadoop May : azkaban- drwxrwxr-x hadoop h ...

  4. struts2 default.xml详解

    struts2  default.xml 内容 1 bean节点制定Struts在运行的时候创建的对象类型. 2 指定Struts-default 包  用户写的package(struts.xml) ...

  5. Fix Some bytes have been replaced with the Unicode substitution character while loading file XXX.cs with Chinese Simplified (GB2312) encoding

    When we use <strong>visual studio</strong> open source file or any other file, we may en ...

  6. Struts的xml包必须继承Struts-default 不然不能使用拦截器与返回类型的功能

    Struts的xml包必须继承Struts-default 不然不能使用拦截器与返回类型的功能

  7. 完美解决iis下JWplayer提示Error loading media: File could not be played错误

    最近开发项目需要使用JWplayer插件播放视频,但是无论换那个版本.换什么样的视频总是提示Error loading media: File could not be played错误,废了好大的劲 ...

  8. [大数据技术]Kettle初次连接MySQL数据库 报错问题 错误连接数据库 Error occured while trying to connect to the database Exception while loading class org.gjt.mm.mysql.Driver

    报错内容如下: 错误连接数据库 [foodmartconn] : org.pentaho.di.core.exception.KettleDatabaseException: Error occure ...

  9. [转]"error while loading shared libraries: xxx.so.x" 错误的原因和解决办法

    [转]"error while loading shared libraries: xxx.so.x" 错误的原因和解决办法 http://blog.csdn.net/sahuso ...

随机推荐

  1. leetcode 【 Remove Duplicates from Sorted Array II 】python 实现

    题目: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For ex ...

  2. 如何利用c++编写不能被继承、但可以在类外定义对象的类

    #include <iostream> #include<string> #include<map> #include<vector> #include ...

  3. [转]/dev/null 命令用法

    /dev/null :代表空设备文件 :代表重定向到哪里,例如:echo "123" > /home/123.txt 1 :表示stdout标准输出,系统默认值是1,所以&q ...

  4. P2846 [USACO08NOV]光开关Light Switching

    题目描述 Farmer John tries to keep the cows sharp by letting them play with intellectual toys. One of th ...

  5. [HAOI2011][bzoj2301] Problem b [莫比乌斯反演+容斥原理+分块前缀和优化]

    题面: 传送门 有洛谷就尽量放洛谷链接呗,界面友好一点 思路: 和HDU1695比较像,但是这一回有50000组数据,直接莫比乌斯反演慢慢加的话会T 先解决一个前置问题:怎么处理a,c不是1的情况? ...

  6. 关于5Gwifi

    但目前全球最快的WiFi传输速度仅为300Mbps(少数可以达到600Mbps),相当于每秒只能传输约36MB的内容.在人们只利用它来看网站.处理邮件的年代,这没什么问题.但到了今天,面对越来越复杂的 ...

  7. HTML 改变文字方向

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. mysql 排序字段与索引有关系吗?

    mysql 排序字段与索引有关系吗?答案与否需要你explain一下你的sql脚本 另外记住:date_add()方法会影响Index_modify_time索引(即:时间字段索引)  一般遇到这样的 ...

  9. Console.Write格式化输出

    原文发布时间为:2009-03-02 -- 来源于本人的百度文章 [由搬家工具导入] C 或 c货币Console.Write("{0:C}", 2.5);   //$2.50Co ...

  10. a kind of async programming in c#, need to reference definition

    void Main() { Run d=new Run(RunHandler); IAsyncResult result= d.BeginInvoke(new AsyncCallback(CallBa ...