4 Replies Latest reply on Sep 17, 2012 8:58 AM by Jose Cruz

    NoClassDefFoundError

    Jose Cruz Newbie

      Hello,

       

      In my company we are migrating from weblogic 10.3.3 to jboss 7.1.1.

      After I deployed one of the EARs in jboss, some methods are working great, even when they are connecting to an Oracle database, but others, cause the below error.

      The datasource its working ok with others applications/ears in jboss, but for this particular class oracle.sql.ArrayDescriptor the error below always remains.

      The oracle driver that we are using its ojdbc6.jar, and its working great in weblogic and in some ears on this jboss instance.

      Any help, please?

       

      thanks,

      José Cruz

       

       

      Caused by: java.lang.NoClassDefFoundError: oracle/sql/ArrayDescriptor

                at pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAOHelper.buildPLSQLAttributesArray(OracleProvisioningMasterDAOHelper.java:66) [ProvisioningDAO.jar:]

                at pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAO.getProvisionings(OracleProvisioningMasterDAO.java:294) [ProvisioningDAO.jar:]

                at pt.controlinveste.pce.provisioningbusiness.business.sessionbeans.ProvisioningView12EJBBean.getProvisioningsBy(ProvisioningView12EJBBean.java:186) [ProvisioningEJB.jar:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]

                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]

                at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                ... 49 more

        • 1. Re: NoClassDefFoundError
          Jay SenSharma Master

          Hi,

           

              Your datasource will be working fine if you will deploy the driver (orjbc6.jar) as a deployable inside the "standalone/deployments" or if you will create a Oracle Driver Module.   However the Classes present inside the Oracle Driver will not be accessible to your Application (it will be available for the JBoss not to your application). Until you use "jboss-deployment-structure.xml" or "META-INF/MANIFEST.MF" file  or "useing a Global Module" to include the dependency to your ojdbc6.jar module.

           

          https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7


           

              So if you want to use ""  class inside your class "pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAOHelper"  then you should either package the "ojdbc6.jar" inside your application or   you will need to create a module containing the "ojdbc6.jar"  and then your code can access any class present inside this jar.

           

          So try the following:

           

          Step1). Create a Oracle Driver module as following:

           

          JBossAS7.1.1/modules/

                                        └──oracle

                                                  └── jdbc

                                                        └── main

                                                                    ├── module.xml

                                                                    ├── ojdbc6.jar

           

           

          module.xml will look like following:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.0" name="oracle.jdbc">

              <resources>

                  <resource-root path="ojdbc6.jar"/>

              </resources>

              <dependencies>

                  <module name="javax.api"/>

                  <module name="javax.transaction.api"/>

              </dependencies>

          </module>

           

           

           

          Then inside your Appliction if it is a WAR then add the following kind of entry inside your    "$WAR/META-INF/MANIFEST.MF" file:

           

          Dependencies: oracle.jdbc

           

          or  declare a Global module as following inside your "standalone.xml" file

           

          <subsystem xmlns="urn:jboss:domain:ee:1.0" >              <global-modules>
              <module name="oracle.jdbc" />            
            </global-modules> 
          </subsystem>
          
          

           

           

            Then your application class "pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAOHelper"  will be able to access the missing classes like "oracle/sql/ArrayDescriptor" which are present inside the ojdbc6.jar

          1 of 1 people found this helpful
          • 2. Re: NoClassDefFoundError
            Jose Cruz Newbie

            Hello Jay,

             

            first, thank you for the help. But now the error is another, and as far as I have seem on the internet its somehow popular, can you help?

             

            The main error:

            - org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

             

             

            ---- Detail

            11:03:53,170 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-localhost-127.0.0.1-8080-1) Application {http://pt.controlinveste.provisioning}ProvisioningView12WS#{http://pt.controlinveste.provisioning}GetProvisioningsBy has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

                      at org.jboss.wsf.stack.cxf.JBossWSInvoker.createFault(JBossWSInvoker.java:246)

                      at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:207)

                      at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)

                      at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_03]

                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_03]

                      at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_03]

                      at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

                      at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)

                      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)

                      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

                      at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)

                      at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)

                      at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)

                      at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)

                      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)

                      at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                      at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)

                      at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.3.GA.jar:2.0.3.GA]

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]

            Caused by: pt.controlinveste.pce.provisioningto.exceptions.ProvisioningException: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

                      at pt.controlinveste.pce.provisioningbusiness.business.sessionbeans.ProvisioningView12EJBBean.getProvisioningsBy(ProvisioningView12EJBBean.java:266) [ProvisioningEJB.jar:]

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]

                      at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]

                      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.webservices.invocation.AbstractInvocationHandlerEJB.invoke(AbstractInvocationHandlerEJB.java:112)

                      at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:181)

                      ... 32 more

            Caused by: java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

                      at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:160) [ojdbc6.jar:11.2.0.2.0]

                      at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:128) [ojdbc6.jar:11.2.0.2.0]

                      at pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAOHelper.buildPLSQLAttributesArray(OracleProvisioningMasterDAOHelper.java:66) [ProvisioningDAO.jar:]

                      at pt.controlinveste.pce.provisioningdao.daos.oracle.OracleProvisioningMasterDAO.getProvisionings(OracleProvisioningMasterDAO.java:294) [ProvisioningDAO.jar:]

                      at pt.controlinveste.pce.provisioningbusiness.business.sessionbeans.ProvisioningView12EJBBean.getProvisioningsBy(ProvisioningView12EJBBean.java:186) [ProvisioningEJB.jar:]

                      ... 68 more

            • 3. Re: NoClassDefFoundError
              Nicklas Karlsson Master

              If you truly need the Oracle-specific stuff, you might want to cast to the WrappedConnection and call getUnderlyingConnection() from there.

              • 4. Re: NoClassDefFoundError
                Jose Cruz Newbie

                Hello,

                 

                I found the solution!

                 

                 

                The MANIFEST.MF of the jar when I want uso native connection must have 2 module references:

                1) com.oracle.db (or any other name you want), which contains the ojdbc6.jar

                2) org.jboss.ironjacamar.jdbcadapters (the module which contains the wrapper connection of jboss 7)

                 

                Dependencies: com.oracle.db, org.jboss.ironjacamar.jdbcadapters

                 

                thanks,

                José Cruz