2 Replies Latest reply on Mar 7, 2012 2:20 AM by Joseph Wu

    exception when deploying class

    Joseph Wu Newbie

      Hi all,

       

      I had a look on test case on HASingleton and just started coding. Below is my simple little class

       

       

       

       

      import org.jboss.msc.service.Service;

       

      import org.jboss.msc.service.StartContext;
      import org.jboss.msc.service.StartException;
      import org.jboss.msc.service.StopContext;


      /**
      * String node = (String) CurrentServiceContainer.getServiceContainer().getService(HASingletonImpl.SERVICE_NAME).getValue();
      * @author Joe
      *
      */
      public class HASingletonImpl implements Service<String>{

      @Override
      public String getValue() throws IllegalStateException,
         IllegalArgumentException {

       

        return null;
      }

      @Override
      public void start(StartContext context) throws StartException { 
      }

      @Override
      public void stop(StopContext context) {

       

      }

       

       

      when I exported this class to a jar beside some othere ejbs( those ejbs worked well without this HASingletonImpl ) ,the server print some stacks as below , how come it report "Caused by: java.lang.NoClassDefFoundError: org/jboss/msc/service/Service" ??? as you can see,this is just an empty class...

       

      ....

      11:22:03,253 INFO  [org.jboss.as.webservices] (MSC service thread 1-8) JBAS015539: Starting service jboss.ws.port-component-link
      11:22:03,270 INFO  [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014142: Started message driven bean 'MailProccessorMDB' with 'hornetq-ra' resource adapter
      11:22:03,288 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class com.biz.ejb.impl.HASingletonImpl in Module "deployment.testEJB.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/biz/ejb/impl/HASingletonImpl (Module "deployment.testEJB.jar:main" from Service Module Loader)
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
      at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
      at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
      at org.jboss.modules.Module.loadModuleClass(Module.java:517)
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
      at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:171)
      at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:489) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:851) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:596) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
      Caused by: java.lang.NoClassDefFoundError: org/jboss/msc/service/Service
      at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_25]
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_25]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_25]
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [rt.jar:1.6.0_25]
      at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
      ... 20 more
      Caused by: java.lang.ClassNotFoundException: org.jboss.msc.service.Service from [Module "deployment.testEJB.jar:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
      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.performLoadClass(ConcurrentClassLoader.java:398)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
      ... 26 more

      11:22:03,339 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."testEJB.jar#EJBjpatest": org.jboss.msc.service.StartException in service jboss.persistenceunit."testEJB.jar#EJBjpatest": Failed to start service
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
      Caused by: java.lang.RuntimeException: error trying to scan <jar-file>: vfs:/D:/Joseph/DEV/TOOLSnSRC/jboss-as-7.1.0.Final/bin/content/testEJB.jar/
      at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:854)
      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:596)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      ... 3 more
      Caused by: java.lang.RuntimeException: JBAS011431: Could not load entity class 'com.biz.ejb.impl.HASingletonImpl' with PersistenceUnitInfo.getClassLoader()
      at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:175)
      at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:489)
      at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:851)
      ... 9 more
      Caused by: java.lang.ClassNotFoundException: com.biz.ejb.impl.HASingletonImpl from [Module "deployment.testEJB.jar:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
      at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:171)
      ... 11 more

      11:22:04,287 INFO  [stdout] (pool-15-thread-2)
      11:22:04,287 INFO  [stdout] (pool-15-thread-2) -------------------------------------------------------------------
      11:22:04,287 INFO  [stdout] (pool-15-thread-2) GMS: address=joe-pc/ejb, cluster=ejb, physical address=127.0.0.1:55200
      11:22:04,287 INFO  [stdout] (pool-15-thread-2) -------------------------------------------------------------------

      11:22:06,308 INFO  [org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.ejb] (MSC service thread 1-8) JBAS010247: New cluster view for partition ejb (id: 0, delta: 0, merge: false) : [joe-pc/ejb]
      11:22:06,449 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (pool-16-thread-2) ISPN000078: Starting JGroups Channel
      11:22:06,449 警告    [org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher] (pool-16-thread-2) Channel Muxer already has a default up handler installed (org.jboss.as.clustering.jgroups.ClassLoaderAwareUpHandler@a1eaf6) but now it is being overridden

       

       

      server was started with "standalone-full-ha.xml"

       

       

      Thank you very much.

        • 1. Re: exception when deploying class
          Joseph Wu Newbie

          done with adding some lines to "standalone-full-ha.xml"

           

           

                  <subsystem xmlns="urn:jboss:domain:ee:1.0">
                      <global-modules>
                          <module name="org.jboss.msc" slot="main"/>
                          <module name="org.jboss.as.clustering.singleton" slot="main"/>
                      </global-modules>
                  </subsystem>

           

           

          hope this helps

          • 2. Re: exception when deploying class
            Joseph Wu Newbie

            a "jboss-deployment-structure.xml" file in META-INF  like this also works

             

             

            <jboss-deployment-structure>
            <deployment>
              <dependencies>
               <module name="org.jboss.msc" />
               <module name="org.jboss.as.clustering.singleton"></module>
              </dependencies>
            </deployment>
            </jboss-deployment-structure>

            1 of 1 people found this helpful