8 Replies Latest reply: Jun 1, 2012 11:15 AM by sd_rc RSS

    EJB Project: Class not found

    sd_rc Newbie

      Hi,

       

      I am running an EJB project on my JBoss server(on eclipse) and a class not found exception is thrown for

      "org.apache.commons.dbutils.ResultSetHandler".

      I believe that this is caused by a missing jar file in the classpath. However, I do not know how to set the

      classpath for an EJB project.

      Please could someone help me on this?

       

      Thanks!

        • 1. Re: EJB Project: Class not found
          jaikiran pai Master

          You'll have to add more details including the exact version of JBoss AS7 and the entire exception stacktrace.

          • 2. Re: EJB Project: Class not found
            sd_rc Newbie

            Thanks jaikiran.

            Here are the details you asked for:

             

            JBoss version: 7.1.1

             

            Stack trace:

             

                                   

            Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbutils/ResultSetHandler

            at com.message_consumer.Queue_Listen.onMessage(Queue_Listen.java:60

            [Queue_List.jar:]

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_10]

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_10]

            at java.lang.reflect.Method.invoke(Method.java:597

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

            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288

            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

            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.invokeInCallerTx(CMTTxInterceptor.java:202) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

            ... 37 more

             

            Caused by:

            java.lang.ClassNotFoundException: org.apache.commons.dbutils.ResultSetHandler from [Module "deployment.EAR_Project.ear.Queue_List.jar:main" from Service Module Loader]

            at org.jboss.modules.ModuleClassLoader.findClass(

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

            at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

            at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [rt.jar:1.6.0_10]

            ... 55 more

            ModuleClassLoader.java:190)

            ) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

            ) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

            ) [rt.jar:1.6.0_10]

            ) [rt.jar:1.6.0_10]

             

            • 3. Re: EJB Project: Class not found
              navuri prasad Newbie

              commons-beanutils

              commons-logging-1.1 etc like some jar missing i think these jars we can found make sure these type of jar set runtime classpath

              • 4. Re: EJB Project: Class not found
                jaikiran pai Master

                navuri prasad wrote:

                 

                commons-beanutils

                commons-logging-1.1 etc like some jar missing i think these jars we can found make sure these type of jar set runtime classpath

                Let's keep the IDE out of this. Ultimately this is a runtime exception that you are seeing on the server. All you have to do is package those jars within your application. If it's a .ear, then just package those in .ear/lib folder or if it's a war then package them in .war/WEB-INF/lib folder.

                • 5. Re: EJB Project: Class not found
                  sd_rc Newbie

                  It is an EJB project. the jar files are in a lib folder. i have also added them in the build path.

                  • 6. Re: EJB Project: Class not found
                    jaikiran pai Master

                    sd_rc wrote:

                     

                    It is an EJB project. the jar files are in a lib folder. i have also added them in the build path.

                    I don't use IDEs to build my deployments, so I have no idea how to get that right. Ultimately, the application package that you are deploying isn't having the necessary jars in it. Someone with IDE packaging experience might be able to help.

                    • 7. Re: EJB Project: Class not found
                      sd_rc Newbie

                      thanks guys. i hope someone can help me out with this!

                      • 8. Re: EJB Project: Class not found
                        sd_rc Newbie

                        Solved the issue. Packaged the EJB project into an EAR package. Then added jar files to the EAR/lib folder.