`

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

    博客分类:
  • java
阅读更多
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包进行开发, 比较保险.
分享到:
评论

相关推荐

    tomcat部署多个项目.pdf

    `Caught exception while loading file struts-default.xml - [unknown location]` 这个异常是因为 Struts 框架中的配置文件 `struts-default.xml` 无法正确地加载。 解决方法 2:配置 Struts 框架 要解决这个...

    配置struts2常见错误

    Console 错误:Caught exception while loading file struts-default.xml **问题描述**: ``` Caught exception while loading file struts-default.xml - [unknown location] ``` **解决方法**: 这个错误通常由...

    [Content_Types].xml[Content_Types].xml[Content_Types].xml

    [Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml[Content_Types].xml

    VC-P-P-exception-handling-documents.zip_异常处理

    "VC/C++源码, FileException" 提供了一个学习VC++异常处理机制的实例,这对于初学者来说是极具价值的。 在C++中,异常处理是通过`try`、`catch`和`throw`关键字来实现的。当程序在`try`块中遇到无法正常处理的错误...

    2019高考英语新课件二轮练习精品测试卷5unit3.doc

    nervously and embarrassingly 紧张且尴尬地(副词形式错误) - B. nervous and embarrassedly 紧张且尴尬地(形容词+副词) - C. nervously and embarrassing 紧张的且令人尴尬的(形容词+副词) - D. nervous ...

    input-caught.rar_Caught

    在给定的"input-caught.rar_Caught"压缩包中,我们可以看到一个名为"输入捕捉通道7.c"的源代码文件,这暗示了该代码是针对特定单片机的输入捕捉功能实现,很可能是用于飞思卡尔(Freescale,现已被NXP半导体收购)的...

    01-ErrorShow.rar_visual c

    std::cerr &lt;&lt; "Caught an exception: " &lt;&lt; e.what() ; } } ``` 在这个例子中,如果`b`为0,函数会抛出一个`std::invalid_argument`异常,然后在`catch`块中捕获并打印错误信息。 除了标准库提供的异常类型,我们...

    Activiti-in-Action.pdf

    the Activiti Engine, and starting in a new job, that time caught up with me. After I had settled in a bit, I took up the writing task again and began working on the remaining chapters. So here I am, ...

    湖南省衡阳县2018 2019学年高二英语12月月考试题(扫描版).doc

    这是一种检查学生语法和用词准确性的练习,下面是给出的错误及其纠正: - 1. 将"Get"改为"Getting",动名词形式作主语 - 2. 将"mostly"改为"most",形容词修饰children - 3. 将"founded"改为"founded",过去分词...

    广东天河中学2021高考英语语法一轮复习基础训练:定语从句02 Word版含答案.docx

    5. **题目**:When he was working there he caught a serious illness from _______ efforts he still suffers. - A. which - B. that - C. whose - D. what - **解析**:此题考查关系代词的使用。“whose”...

    小学英语专项练习动词.doc

    18. catch - caught 19. fall - fell 20. do - did 21. buy - bought 22. see - saw 23. shop - shopped 24. begins - began 25. e - ate 26. take - took 27. miss - missed 28. like - liked 29. get - got 30. ...

    No-callback-form-caught.rar_Caught

    标题中的"No-callback-form-caught"暗示我们将探讨一种不依赖回调函数的网络抓包方法。下面将详细介绍这种技术以及其背后的原理。 网络抓包通常涉及到网络层协议,如TCP/IP协议栈,它允许我们查看原始的数据包,...

    netty-4.0.41-2016-9-29官网下载

    5. **强大的异常处理**:Netty提供了强大的异常处理机制,如ChannelInboundHandlerAdapter中的exceptionCaught方法,可以捕获并处理各种网络异常。 6. **灵活的缓冲区**:Netty自定义了ByteBuf作为数据缓冲区,支持...

    java基础知识测试题

    **解析:** `switch` 表达式支持 `char` 类型,当 `c` 的值等于 `'a'` 时,会匹配到第一个 `case` 条件,输出 "a" 后由于有 `break` 语句,所以不会继续执行后面的 `default` 语句块。 ### 11. 异常处理选择题 **...

    netty-all-4.0.0.Final-source

    6. **强大的异常处理**:Netty提供了一种统一的异常处理机制,通过ChannelInboundHandlerAdapter中的exceptionCaught方法捕获和处理异常,增强了系统的健壮性。 7. **兼容性和稳定性**:Netty 4.0版本是一个成熟的...

    英语动词不规则变化表--origin.doc

    4. "catch"(抓住):catch, caught, caught A-B-A型动词的变化则是在过去式和过去分词之间有一个不规则变化。例如: 1. "overcome"(克服):overcome, overcame, overcome 2. "become"(变成):become, became, ...

    Could not perform operation -- unexpected exception. Unexpected failure (8000ff

    错误提示中的“Unexpected failure (8000ffff)”明确指出了一个非预期的失败情况,通常这类错误表明程序在执行过程中遇到了未被预料到的问题,导致程序无法正常继续执行。根据提供的信息,我们可以初步判断错误发生...

    黑龙江省实验中学2020-2021学年高一下学期4月月考英语试题 Word版含答案.docx

    caught - C. catching - D. to catch **解析**: 此题考查非谓语动词的用法。根据句意,“冲浪者在捕捉海浪的过程中展示他们对海洋的爱与热情”,这里“捕捉海浪”是对“冲浪者”的补充说明,因此应选用现在分词...

Global site tag (gtag.js) - Google Analytics