无法初始化 class oracle.jdbc.driver.DMSFactory TopLink 12c 和 Glassfish 3.1.2

Could not initialize class oracle.jdbc.driver.DMSFactory TopLink 12c and Glassfish 3.1.2

几周来我一直处于部署问题中,我正在寻求您的帮助。

我正在尝试部署使用 JDeveloper 12.1.2 构建的 J2E 网络应用程序。我使用 topLink 作为 ORMGlassfish 3.1.2 作为 ASJDK 7Oracle 11g 作为 DBMS

部署我项目的 .EAR 文件后,我在尝试通过我的应用程序时遇到此异常

java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.driver.DMSFactory

我在我的项目类路径中添加了 ojdbc7dms.jar,但仍然有相同的异常。与 ojdbc7.jar

相同的行为

这是我的session.xml文件内容

<?xml version="1.0" encoding="windows-1252" ?>
<sessions version="2.4.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <session xsi:type="server-session">
    <name>default</name>
    <!--<server-platform xsi:type="weblogic-10-platform"/>-->
    <primary-project xsi:type="xml">META-INF/dbMap.xml</primary-project>
  </session>
</sessions>

在异常的完整堆栈跟踪下方

[#|2016-09-09T17:04:15.823+0000|SEVERE|glassfish3.1.2|oracle.adf.model.adapter.bean.BeanDCInvocationHandler|_ThreadID=47;_ThreadName=Thread-2;|InvocationTargetException ->invoke(findAllAdminModuleByRef) java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at oracle.adf.model.adapter.bean.BeanDCInvocationHandler.invoke(BeanDCInvocationHandler.java:158) at oracle.adf.model.adapter.bean.BeanDCInvocationHandler.invokeMethod(BeanDCInvocationHandler.java:69) at oracle.adf.model.adapter.bean.BeanDCInvocationHandler.invoke(BeanDCInvocationHandler.java:139) at oracle.adf.model.adapter.bean.BeanDCInvokeMethodHandler.invoke(BeanDCInvokeMethodHandler.java:125) at oracle.adf.model.adapter.bean.UpdatableBeanDataControl.invokeOperation(UpdatableBeanDataControl.java:600) at oracle.adf.model.adapter.bean.JavaBeanDataControl.invokeOperation(JavaBeanDataControl.java:388) at oracle.adf.model.bean.DCBeanDataControl.invokeMethod(DCBeanDataControl.java:477) at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:266) at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1658) at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2189) at oracle.adf.model.bean.DCBeanDataControl.invokeOperation(DCBeanDataControl.java:560) at oracle.adf.model.adapter.AdapterDCService.invokeOperation(AdapterDCService.java:309) at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:751) at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:407) at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:255) at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:213) at org.devtools.RhTools.executeAction(RhTools.java:152) at beans.admin.Mb_cfgDashboard.cfgDashboardAfterPhase(Mb_cfgDashboard.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.el.parser.AstValue.invoke(AstValue.java:254) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.component.UIViewRoot.notifyPhaseListeners(UIViewRoot.java:1050) at javax.faces.component.UIViewRoot.notifyAfter(UIViewRoot.java:853) at javax.faces.component.UIViewRoot.encodeEnd(UIViewRoot.java:1005) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) at oracle.adfinternal.view.faces.component.AdfViewRoot.encodeAll(AdfViewRoot.java:102) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.renderView(ViewDeclarationLanguageWrapper.java:101) at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.renderView(ViewDeclarationLanguageWrapper.java:101) at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.renderView(ViewDeclarationLanguageFactoryImpl.java:338) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:170) at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager.runRenderView(ResponseRenderManager.java:52) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1104) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:389) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:255) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at oracle.adf.share.http.ServletADFFilter.doFilter(ServletADFFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:745) Caused by: javax.ejb.EJBException at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5215) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5113) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4901) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:222) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88) at com.sun.proxy.$Proxy116.findAllAdminModuleByRef(Unknown Source) ... 100 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.driver.DMSFactory at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:4361) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:805) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:420) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:612) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:187) at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98) at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:293) at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:418) at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:216) at org.eclipse.persistence.sessions.server.ConnectionPool.startUp(ConnectionPool.java:504) at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:484) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:633) at org.eclipse.persistence.sessions.factories.SessionManager.getSession(SessionManager.java:417) at org.eclipse.persistence.sessions.factories.SessionManager.getSession(SessionManager.java:363) at org.eclipse.persistence.sessions.factories.SessionFactory.getSharedSession(SessionFactory.java:148) at org.eclipse.persistence.sessions.factories.SessionFactory.getSharedSession(SessionFactory.java:127) at org.eclipse.persistence.sessions.factories.SessionFactory.acquireSession(SessionFactory.java:167) at ejb.admin.adminSessionEJBBean.findAllAdminModuleByRef(adminSessionEJBBean.java:196) at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052) at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124) at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388) at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800) at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162) at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144) at sun.reflect.GeneratedMethodAccessor187.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861) at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800) at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370) at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214) ... 102 more |#]

我终于找到了解决办法。当我使用 Jdeveloper 12c 时,我只是在 model 项目库和类路径中添加了 ojdbcdms6.jar 文件,此外还有这个jar 已添加到 viewcontroller 项目库和类路径中。