问题
I am attempting to start up a Struts 1.X (version 1.3.10) application using OC4J version 10.1.3.5. The application manages to initialize all the Spring beans, including the Struts Actions defined in action-servlet.xml. However, once all the beans are initialized, I get a rather ugly exception in the log.
I suspected an issue in xalan (2.7.1), xercesImpl (2.9.1), or xml-apis (1.3.04), but all these are using the newest versions. The exception says that a dependency may be missing, but I am unable to determine what it might be.
Any help is appreciated. (Note: I can't update to Struts 2.X at this time. The application is a legacy one that will likely be replaced).
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)
回答1:
I faced this issue when i tried to validate xml file using xml schema. I googled and found out the root cause for this issue.
Jar files like xerces-2.6.2.jar, crimson.jar, xalan.jar along with jaxp.jar has older version SAXParserFactory. So all the above jar files should be removed from class parh.
Remove or update jar based on its jars with correct version.
回答2:
If it helps anyone : I had a similar issues and providing the SaxParserFactory as a JVM option worked
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
回答3:
Never mind, I hadn't configured OC4J's global-web-application.xml to search local classes first or created a custom orion-web.xml file to do the same thing.
If you run into this issue, the easiest (big hammer) approach is to add this line to (oc4j dir)\j2ee\home\config\global-web-application.xml:
<web-app-class-loader search-local-classes-first="true"/>
The problem is that if you try to use Xerces or another somewhat up-to-date SAX parser, you'll run into a classpath issue with the one Oracle tries to force down your throat (same as with any of their products).
回答4:
Use Commons Digester 1.7, instead of the Commons Digester that is included with JDeveloper. http://jakarta.apache.org/commons/digester/
来源:https://stackoverflow.com/questions/2102594/struts-1-3-10-digester-getparser-unsupportedoperationexception