10 Replies Latest reply on Sep 27, 2003 2:45 AM by Sean Radford

    java.lang.NoClassDefFoundError: org/jboss/system/ServiceMBea

    w4w Newbie

      I'm using jboss-4.0.0DR1_tomcat-4.1.24 version and I followed the steps from SUN's web site to make my first Stateless Session Bean.

      http://developer.java.sun.com/developer/onlineTraining/Beans/EJBTutorial/TOC.html

      After making the apropiate changes to get my Code run, I'm getting following exception when I execute the client side.
      ---------------------------------------------------------------------
      Begin statelessSession DemoClient...
      java.lang.NoClassDefFoundError: org/jboss/system/ServiceMBeanSupport
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:207)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1503)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1511)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1616)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1795)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1759)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1795)
      at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1688)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1634)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:522)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:479)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at ejb.demo.DemoClient.main(DemoClient.java:34)
      Exception in thread "main"
      -------------------------------------------------------------------

      It's obvious that ServiceMBeanSupport class is not found. Although I would like to know in what library it is supposed to be, the only similar class I could find was in the jboss-all-client.jar, but the name is ServiceMBeanSupportMBean, is this a typo?

        • 1. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
          Juha Lindfors Master

          DR1 is a developer's release, I recommend you use 3.2.1 if you're learning EJB.

          • 2. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
            cjohann Newbie

            > DR1 is a developer's release, I recommend you use > 3.2.1 if you're learning EJB.

            This is still an issue though. I am having the same problem. Any ideas as to what the problem is?

            Thanks.

            • 3. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
              mdossantos Newbie

              Found out that this class is located in the jboss-system.jar. But after you that, you will get a java.lang.NoClassDefFoundError: javax/management/NotificationBroadcasterSupport exception.

              This happens when simply trying to lookup the home interface of a Session Bean.

              Ideas/suggestions appreciated...

              • 4. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                Brendan W. McAdams Newbie

                I'm having the EXACT same problem, exact same circumstances.

                Want to play with the new Timers for a project i'm working on, and no dice.

                Lookup on the Home just completely chokes on NoClassDef for org.jboss.system.ServiceMBeanSupport.

                It's occurring within the Bean itself as far as I can tell...

                Any thoughts?

                • 5. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                  geejee Newbie

                  Just in case you have not discoverred this yourself. The class is located in jboss-jmx.jar

                  • 6. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                    morten Matras Newbie

                    I think I'm having the same problem, but my problem arises when I try to make a Dynamic Proxy copy of a local Object and returns it to tomcat.

                    That is if I return a Collection of Dynamic Proxy Copies to Tomcat, then the following error arises:
                    java.lang.NoClassDefFoundError: org/jboss/system/Service

                    If I change the copies with simple Strings, then no error is produced so the problem seems to have something to do with Dynamic Proxies.

                    Regards

                    Morten Andersen
                    Denmark

                    • 7. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                      Yogesh Prajapati Newbie

                      Here is my stack trace when trying to run simple session ejb client. I developed my EJB/client using JBossEJB example Template. The session EJB is deployed properly.

                      Any suggesstion/workarround is much appreciated.

                      /usr/local/j2se/jre/bin/java -classpath ../client/bas-jdo.jar:../client/bas-common.jar:../client/bas-client.jar:/usr/local/jboss/client/log4j.jar:/usr/local/jboss/client/jsse.jar:/usr/local/jboss/client/jnp-client.jar:/usr/local/jboss/client/jnet.jar:/usr/local/jboss/client/jmx-rmi-connector-client.jar:/usr/local/jboss/client/jmx-ejb-connector-client.jar:/usr/local/jboss/client/jmx-connector-client-factory.jar:/usr/local/jboss/client/jcert.jar:/usr/local/jboss/client/jboss-transaction-client.jar:/usr/local/jboss/client/jboss-system-client.jar:/usr/local/jboss/client/jbosssx-client.jar:/usr/local/jboss/client/jboss-persistence-client.jar:/usr/local/jboss/client/jboss-net-client.jar:/usr/local/jboss/client/jbossmqha.jar:/usr/local/jboss/client/jbossmq-client.jar:/usr/local/jboss/client/jboss-jsr77-client.jar:/usr/local/jboss/client/jbossjmx-ant.jar:/usr/local/jboss/client/jboss-jms-p2p-client.jar:/usr/local/jboss/client/jboss-jaas.jar:/usr/local/jboss/client/jboss-j2ee.jar:/usr/local/jboss/client/jboss-iiop-client.jar:/usr/local/jboss/client/jbossha-client.jar:/usr/local/jboss/client/jboss-common-client.jar:/usr/local/jboss/client/jboss-client.jar:/usr/local/jboss/client/jboss-all-client.jar:/usr/local/jboss/client/jacorb.jar:/usr/local/jboss/client/gnu-regexp.jar:/usr/local/jboss/client/getopt.jar:/usr/local/jboss/client/concurrent.jar net.allentek.bas.ha.ejb.client.HospitalAdministratorClient
                      Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/system/ServiceMBeanSupport
                      at java.lang.ClassLoader.defineClass0(Native Method)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
                      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
                      at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
                      at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
                      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
                      at java.lang.ClassLoader.defineClass0(Native Method)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
                      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
                      at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
                      at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
                      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:219)
                      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:154)
                      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
                      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
                      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
                      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
                      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
                      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
                      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
                      at java.util.HashMap.readObject(HashMap.java:1006)
                      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 java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
                      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
                      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
                      at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:113)
                      at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
                      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
                      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
                      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
                      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
                      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
                      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
                      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
                      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:522)
                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:479)
                      at javax.naming.InitialContext.lookup(InitialContext.java:347)
                      at net.allentek.bas.ha.ejb.client.HospitalAdministratorClient.main(HospitalAdministratorClient.java:30)

                      • 8. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                        kasee Newbie

                        hi,

                        Reason for this error is you have forgot to add the jar files which are under lib folder of JBoss. Add the jar files of lib folder to the classpath will solve this issue.

                        I have experienced the same & now it works.

                        • 9. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                          Sean Radford Novice

                          I'm getting a similar/same problem with a remote JNDI lookup (http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= - and it's not due to not including the jars.

                          • 10. Re: java.lang.NoClassDefFoundError: org/jboss/system/Service
                            Sean Radford Novice

                            I've sorted my problem... take a look at the thread to see how (http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= question is: Why do we now need to include non-client jars? (or shouldn't the non-client ones be moved into the client directory too - and the classes added to jboss-all-client.jar)