6 Replies Latest reply on Nov 20, 2003 8:01 AM by andreacervi

    Problem porting EJB from Jboss3.0.8 to 3.2.2

    andreacervi Newbie

      Hi Guys,

      I ma porting my EJB in EAR format from jboss 3.0.8 to 3.2.2. I am using oracle 9.2.0.2 via OCI connection.

      The EAR that work with jboss3.0.8 catch the following exception with jboss3.2.2 at client connection time:

      18:51:26,653 ERROR [DBBean] No ClassLoaders found for: org.jboss.resource.adapter.jdbc.local.LocalConnection
      java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.resource.adapter.jdbc.local.LocalConnection
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:241)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:169)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:123)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at DBBean.DBBean.initDatabaseConnection(DBBean.java:3332)
      at DBBean.DBBean.getDatabaseConnection(DBBean.java:3367)
      at DBBean.DBBean.openDatabaseConnection(DBBean.java:3433)
      at DBBean.DBBean.ejbCreate(DBBean.java:2204)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatefulSessionContainer.createSession(StatefulSessionContainer.java:511)
      at org.jboss.ejb.StatefulSessionContainer.createHome(StatefulSessionContainer.java:564)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invokeHome(StatefulSessionContainer.java:880)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(StatefulSessionInstanceInterceptor.java:126)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.StatefulSessionContainer.internalInvokeHome(StatefulSessionContainer.java:404)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      18:51:26,663 ERROR [DBBean] No ClassLoaders found for: org.jboss.resource.adapter.jdbc.local.LocalConnection
      java.sql.SQLException: No ClassLoaders found for: org.jboss.resource.adapter.jdbc.local.LocalConnection
      at DBBean.DBBean.initDatabaseConnection(DBBean.java:3352)
      at DBBean.DBBean.getDatabaseConnection(DBBean.java:3367)
      at DBBean.DBBean.openDatabaseConnection(DBBean.java:3433)
      at DBBean.DBBean.ejbCreate(DBBean.java:2204)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatefulSessionContainer.createSession(StatefulSessionContainer.java:511)
      at org.jboss.ejb.StatefulSessionContainer.createHome(StatefulSessionContainer.java:564)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invokeHome(StatefulSessionContainer.java:880)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(StatefulSessionInstanceInterceptor.java:126)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.StatefulSessionContainer.internalInvokeHome(StatefulSessionContainer.java:404)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.resource.adapter.jdbc.local.LocalConnection
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:241)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:169)
      at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:123)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at DBBean.DBBean.initDatabaseConnection(DBBean.java:3332)
      ... 42 more

      Does any of you help me?

      Best Regards,

      Andrea

        • 1. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
          micke Novice

          I think the Connection wrapper is changed.
          Have you updated your DS moving to 3.2.2?

          /micke

          • 2. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
            andreacervi Newbie

            Hi miky,

            I did. I have ported the DS in jboss3.0.6 to the new format for jboss3.2.2 usnin the normal ds because i do not have xa transaction format.

            best regards,

            Andrea

            • 3. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
              micke Novice

              I assume you grab the connection from the ds then.
              Are you sure you didnt include any other "older" jars when moving?

              Class LocalConnection is not in 3.2.2

              /micke

              • 4. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
                andreacervi Newbie

                Hi micke,

                Now I have discovered what is going on.
                I am doing the porting of the configuration, I did not do the bean. I have just discovered, viewing the source code, that we need to use the OracleConnection to use the Oracle.BLOB type (we need to use the temporary blob) so, as you can see in the following function, we do a Class.forName on the org.jboss.resource.adapter.jdbc.local.LocalConnection class to use the getUnderlyingConnection to retrive the OracleConnection.

                private void initDatabaseConnection()
                throws SQLException {

                DataSource ds = null;
                InitialContext ic = null;

                try{
                ic = new InitialContext();
                ds = (DataSource) ic.lookup(dataSource);
                jbossLocalConnection = ds.getConnection();

                // get the underlying connection which MUST be an OracleConnection
                Class jbossLocalConnectionClass = Class.forName("org.jboss.resource.adapter.jdbc.local.LocalConnection");
                getUnderlyingConnectionMethod = jbossLocalConnectionClass.getMethod("getUnderlyingConnection", null);

                ic.close();

                try {
                ((OracleConnection) getOracleDatabaseConnection()).setStatementCacheSize(100);
                log.debug("This oracle connection has a statement cache size of : " + ((OracleConnection) getOracleDatabaseConnection()).getStatementCacheSize());
                }
                catch (SQLException ignore) {}
                catch (DBException ignore) {}

                }
                catch (NamingException e) {
                log.error(e.getMessage(), e);

                throw (SQLException) new SQLException(e.getMessage()).initCause(e);
                } catch (ClassNotFoundException e) {
                log.error(e.getMessage(), e);

                throw (SQLException) new SQLException(e.getMessage()).initCause(e);
                } catch (NoSuchMethodException e) {
                log.error(e.getMessage(), e);

                throw (SQLException) new SQLException(e.getMessage()).initCause(e);
                }
                }

                Now that the org.jboss.resource.adapter.jdbc.local.LocalConnection class is no more present in jboss3.2 do you know which class (and function) we can use to perform the same functionality?

                Best Regards,

                Andrea

                • 5. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
                  micke Novice

                  Use org.jboss.resource.adapter.jdbc.WrappedConnection

                  /micke

                  • 6. Re: Problem porting EJB from Jboss3.0.8 to 3.2.2
                    andreacervi Newbie

                    Thanks guys,

                    Now, this step of the porting is done.

                    Regards,

                    Andrea