7 Replies Latest reply on Oct 31, 2003 7:21 AM by Adrian Brock

    how to load extra lib to jboss

    julian_hu Newbie

      I made a Session Bean. In this session bean i used CachedRowSet to return some data from database.
      I succeeded deploying it to jboss 3.2.1. But when i used my client to call the session bean,the jboss gave a ClassNotFoundException. it told me class sun.jdbc.rowset.CachedRowSet is not found. I have already copied rowset.jar to server/all/lib/. How can I resolve this problem. Thanks a lot

        • 1. Re: how to load extra lib to jboss
          Adrian Brock Master

          Did you reboot server, server/all/lib is not hotdeployed.

          Show the full stacktrace and the context under which the
          classloading occurs.

          Regards,
          Adrian

          • 2. Re: how to load extra lib to jboss
            julian_hu Newbie

            yes,of course i have rebooted the server.
            there is the stacktrace

            java.lang.NoClassDefFoundError: sun/jdbc/rowset/CachedRowSet
            at com.Intelliprise.Test2.EJB.GetDataBean.doGetData(GetDataBean.java:49)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionConta
            iner.java:629)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionI
            nterceptor.java:186)
            at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstance
            Interceptor.java:72)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.
            java:122)
            at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322
            )
            at org.jboss.ejb.Container.invoke(Container.java:674)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
            )
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
            at java.lang.reflect.Method.invoke(Native Method)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:236)
            at sun.rmi.transport.Transport$1.run(Transport.java:147)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:143)
            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:479)

            • 3. Re: how to load extra lib to jboss
              Adrian Brock Master

              What is doGetData doing?

              I doubt it is throwing a NoClassDefFoundError at line 49

              Regards,
              Adrian

              • 4. Re: how to load extra lib to jboss
                julian_hu Newbie

                here is the code of doGetData

                public RowSet doGetData(String sql){
                Connection conn=null;
                ResultSet rs;
                CachedRowSet crs;
                CachedRowSet result;
                try{
                Hashtable env=new Hashtable();
                env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
                //env.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");
                InitialContext jndiCntx = new InitialContext(env);

                DataSource ds=(DataSource)jndiCntx.lookup("java:/MySqlDS");

                conn=ds.getConnection();

                Statement st=conn.createStatement();

                rs=st.executeQuery("Select * from sm_opuser");
                crs=new CachedRowSet();
                crs.populate(rs);
                crs.setTableName(sql);
                rs.close();
                st.close();
                result=crs;


                }catch(Exception e){
                e.printStackTrace();
                result=null;
                }
                return result;
                }

                • 5. Re: how to load extra lib to jboss
                  Adrian Brock Master

                  I'd be very suprised if that code works.

                  The java:/ namespace is inaccessible if you
                  specify a ProviderUrl

                  Use new InitialContext()

                  Regards,
                  Adrian

                  • 6. Re: how to load extra lib to jboss
                    julian_hu Newbie

                    i found this code in this Forum..
                    Any way,,can you give a right example,how to use CachedRowSet get data from mysql in Session bean in Jboss,thanks a lot.

                    • 7. Re: how to load extra lib to jboss
                      Adrian Brock Master

                      I've never used it.
                      Are you sure it doesn't require a jdbc3 compliant driver?
                      You might have more luck if you asked your question
                      in the persistence forum.

                      I was commenting on your use of jndi.

                      Regards,
                      Adrian