Java确定ClassNotFound的原因

时间:2019-04-15 18:49:52

标签: java weblogic classnotfoundexception weblogic12c

我在Oracle Weblogic应用服务器中部署了Java EAR应用程序。 该应用程序正在处理一些HTTP请求等 其中之一正在处理一些XML文件(形成文件系统)

有趣的是,将完全相同的EAR文件部署在另一台服务器计算机上,该服务器文件是根据相同的安装手册(如第一个安装手册)进行设置的,在此我收到以下未找到的类异常:

org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
    at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
    at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191)
    at org.example.application.BL.data.ResourceParser.parse(ResourceParser.java:178)
    at org.example.application.BL.data.DataModel.validate(DataModel.java:323)
    at org.example.application.BL.action.Update.execute(Update.java:165)
    at org.example.application.webapp.ActionControl.doGet(ActionControl.java:78)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3682)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1026)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:987)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:83)
    at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:608)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:540)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:493)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:470)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:62)
    at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82)
    at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228)
    ... 32 more

在可疑行上:

final XMLReader parser = XMLReaderFactory.createXMLReader();

我检查了两个服务器(相同的Java,Weblogic等)在应用程序上是否具有相同的类路径,相同的命令行参数,并检查了它们是否打开了相同的文件(lsof),并且它们匹配所有jar文件等(日志文件除外)。

当前,我有点恼火,因为其中一个加载了另一个不能访问的SAX表单。

运行于:Java 8,WebLogic 12c;

编辑:我在日志中找到了一个很好的地方-但无法确定原因:

Apr 15, 2019 12:30:04 PM weblogic.wsee.runtime.JMSStoreRoutableIDMapper addServerSetListener
INFO: add ServerSetListener for partition: DOMAIN
Warning: org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
Warning: org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
Apr 15, 2019 12:30:38 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://docs.oasis-open.org/ws-tx/wsat/2006/06}ATAssertion" was evaluated as "UNKNOWN".
Apr 15, 2019 12:30:38 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".

0 个答案:

没有答案