2013-10-25 37 views
4

我部署在WebSphere Application Server 8.5 J2EE Web應用程序不兼容。爲8.5:java.lang.ClassCastException:org.apache.xerces.jaxp.SAXParserFactoryImpl與javax.xml.parsers.SAXParserFactory中

Web應用程序具有包含所有第三方庫的共享庫。所有內部編碼的庫位於WEB-INF/lib文件夾內。

的問題是,在只有一些JSP的是它拋出以下異常。

我認爲它與xercesImpl-2.8.1.jar有關,但我不明白爲什麼它拋出這個異常以及爲什麼它僅在某些頁面投擲。

在tomcat中它工作得很完美。

java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl incompatible with javax.xml.parsers.SAXParserFactory 
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source) 
    at org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:152) 
    at org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:96) 
    at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateTagLib(ValidateVisitor.java:1129) 
    at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitJspRootStart(ValidateVisitor.java:491) 
    at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:233) 
    at com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:216) 
    at com.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:127) 
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:254) 
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:121) 
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:535) 
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:452) 
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:283) 
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.findWrapper(AbstractJSPExtensionProcessor.java:456) 
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.getServletWrapper(AbstractJSPExtensionProcessor.java:337) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:963) 
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1384) 
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:193) 
    at com.ieci.tecdoc.isicres.servlets.QryInitAdvanSearch.doWork(QryInitAdvanSearch.java:209) 
    at com.ieci.tecdoc.isicres.servlets.QryInitAdvanSearch.doGet(QryInitAdvanSearch.java:67) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456) 
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92) 
    at com.ieci.tecdoc.isicres.filters.URLCheckFilter.doFilter(URLCheckFilter.java:106) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) 
    at com.ieci.tecdoc.isicres.filters.LoginCheckFilter.doFilter(LoginCheckFilter.java:119) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) 
    at com.ieci.tecdoc.isicres.filters.XSSFilter.doFilter(XSSFilter.java:72) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) 
    at com.ieci.tecdoc.isicres.filters.UTF8Filter.doFilter(UTF8Filter.java:65) 
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:926) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1023) 
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703) 
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962) 
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:522) 
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:311) 
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:87) 
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) 
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) 
+0

http://stackoverflow.com/questions/8179399/javax-xml-parsers-saxparserfactory-classcastexception也許可以幫助你。 – ZaoTaoBao

+0

看看我對這個問題的特定變體的解決方案:http://stackoverflow.com/questions/37351807/remove-xercesimpl-2-8-1-jar-from-the-application。 – Mark

回答

5

基本上,存在於JRE(如XML解析器)公共庫不應當與應用程序交付。這可以避免各種不兼容問題,例如您所面對的問題。

如果您仍然需要使用Xerces的特定版本,更改類加載網絡模塊PARENT_LAST的政策。在這種情況下,該庫將從WEB-INF/lib中獲取。這並不能保證你不會有問題。

概括起來:從應用程序中刪除xercesImpl-2.8.1.jar。 JRE提供了XML解析器實現。在大多數情況下,你不需要知道哪一個。

0

我解決了它改變共享庫的關聯。

本來的xerces文庫包括作爲下應用級共享庫,因此這些文庫比應用程序服務器之前加載。

我將共享庫關聯更改爲模塊級別,現在這些庫在應用程序服務器之後加載,並且異常消失。

enter image description here