Struts 1.3.10 Digester.getParser()UnsupportedOperationException

时间:2010-01-20 15:39:58

标签: java struts

我正在尝试使用OC4J版本10.1.3.5启动Struts 1.X(版本1.3.10)应用程序。应用程序设法初始化所有Spring bean,包括action-servlet.xml中定义的Struts Actions。但是,一旦所有bean都被初始化,我在日志中会得到一个相当丑陋的异常。

我怀疑xalan(2.7.1),xercesImpl(2.9.1)或xml-apis(1.3.04)中存在问题,但所有这些都使用最新版本。例外情况表明可能缺少依赖关系,但我无法确定它可能是什么。

感谢任何帮助。 (注意:我目前无法更新到Struts 2.X。该应用程序是一个可能被替换的遗留应用程序。)

 Digester.getParser:                                                                             08:18:10,794 ERROR Digester(789)
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
    at javax.xml.parsers.SAXParserFactory.setXIncludeAware(SAXParserFactory.java:390)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:534)
    at org.apache.commons.digester.Digester.getParser(Digester.java:786)
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
    at org.apache.commons.digester.Digester.parse(Digester.java:1887)
    at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1785)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:349)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
    at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
    at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
    at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
    at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
    at com.evermind.server.Application.getHttpApplication(Application.java:592)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
    at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:701)
    at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:308)
    at com.evermind.server.http.HttpServer.setSites(HttpServer.java:280)
    at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:180)
    at com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2541)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1058)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
    at java.lang.Thread.run(Thread.java:595)
Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable.  Most likely, this is due to an incorrect or missing library dependency. 08:18:10,802 ERROR ActionServlet(398)
java.lang.NullPointerException
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
    at org.apache.commons.digester.Digester.parse(Digester.java:1887)
    at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1785)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:349)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
    at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
    at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
    at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
    at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
    at com.evermind.server.Application.getHttpApplication(Application.java:592)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
    at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:701)
    at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:308)
    at com.evermind.server.http.HttpServer.setSites(HttpServer.java:280)
    at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:180)
    at com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2541)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1058)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
    at java.lang.Thread.run(Thread.java:595)
Digester.getParser:                                                                             08:18:20,228 ERROR Digester(789)
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
    at javax.xml.parsers.SAXParserFactory.setXIncludeAware(SAXParserFactory.java:390)
    at org.apache.commons.digester.Digester.getFactory(Digester.java:534)
    at org.apache.commons.digester.Digester.getParser(Digester.java:786)
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
    at org.apache.commons.digester.Digester.parse(Digester.java:1887)
    at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1785)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:349)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
    at com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:3139)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:775)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable.  Most likely, this is due to an incorrect or missing library dependency. 08:18:20,231 ERROR ActionServlet(398)
java.lang.NullPointerException
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:1058)
    at org.apache.commons.digester.Digester.parse(Digester.java:1887)
    at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1785)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:349)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
    at com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:3139)
    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:775)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
    at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)

4 个答案:

答案 0 :(得分:4)

当我尝试使用xml架构验证xml文件时,我遇到了这个问题。我用Google搜索并找出了这个问题的根本原因。

jar文件,如xerces-2.6.2.jar,crimson.jar,xalan.jar 与jaxp.jar有旧版本SAXParserFactory。所以以上都是jar 应从parh。

类中删除文件

根据罐子的正确版本删除或更新jar。

答案 1 :(得分:4)

如果它可以帮助任何人:我有类似的问题并提供SaxParserFactory作为JVM选项工作

-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl

答案 2 :(得分:0)

没关系,我没有配置OC4J的global-web-application.xml来首先搜索本地类,或者创建了一个自定义的orion-web.xml文件来做同样的事情。

如果遇到这个问题,最简单的(大锤子)方法是将此行添加到(oc4j dir)\ j2ee \ home \ config \ global-web-application.xml:

<web-app-class-loader search-local-classes-first="true"/>

问题在于,如果你尝试使用Xerces或其他一些有点最新的SAX解析器,你会遇到一个类路径问题,甲骨文会试图强迫你的喉咙(与他们的任何产品一样) )。

答案 3 :(得分:0)

使用Commons Digester 1.7,而不是JDeveloper附带的Commons Digester。 http://jakarta.apache.org/commons/digester/