6 Replies Latest reply on May 12, 2015 5:15 PM by Lars Bilger

    java.lang.ClassNotFoundException: org.jboss.as.osgi.deployment.OSGiDeploymentAttachment from [Module "deployment.arquillian-service:main" from Service Module Loader]

    Luke Ab Newbie

      Hi,

       

      I´ve encountered an Exception while trying to test my EJB which uses an JPA EntityManager. My Container is JBoss 7.1.3. The server starts up fine, but after the deployment while trying to run the test, the following exception occurs:

       

      12:46:43,254 SEVERE [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-3-thread-1) Failed: de.soptim.security.domain.OrganisationServiceTestWithArquillian.testAddOrganisation: java.lang.NoClassDefFoundError: org/jboss/as/osgi/deployment/OSGiDeploymentAttachment

          at org.jboss.as.arquillian.service.ArquillianConfig.loadClass(ArquillianConfig.java:118) [arquillian-service:]

          at org.jboss.as.arquillian.service.ArquillianService$ExtendedTestClassLoader.loadTestClass(ArquillianService.java:259) [arquillian-service:]

          at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:125) [arquillian-service:]

          at org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethod(JMXTestRunner.java:108) [arquillian-service:]

          at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethod(ArquillianService.java:226) [arquillian-service:]

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

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_35]

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

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262) [rt.jar:1.6.0_35]

          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) [rt.jar:1.6.0_35]

          at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) [rt.jar:1.6.0_35]

          at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:498)

          at org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)

          at org.jboss.remotingjmx.protocol.v1.ServerProxy$InvokeHandler.handle(ServerProxy.java:1034)

          at org.jboss.remotingjmx.protocol.v1.ServerProxy$MessageReciever$1.run(ServerProxy.java:215)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]

      Caused by: java.lang.ClassNotFoundException: org.jboss.as.osgi.deployment.OSGiDeploymentAttachment from [Module "deployment.arquillian-service:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.3.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.3.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.3.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.3.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.3.GA]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.3.GA]

          ... 23 more

       

      The Arquillian related dependencies i´ve inserted into my pom are:

       

      <!-- Arquillian -->

      <dependency>

           <groupId>org.jboss.arquillian.junit</groupId>

           <artifactId>arquillian-junit-container</artifactId>

           <scope>test</scope>

      </dependency>

      <dependency>

           <groupId>org.jboss.as</groupId>

           <artifactId>jboss-as-arquillian-container-managed</artifactId>

           <version>7.1.1.Final</version>

           <scope>test</scope>

      </dependency>

      <dependency>

           <groupId>org.jboss.arquillian.protocol</groupId>

           <artifactId>arquillian-protocol-servlet</artifactId>

           <scope>test</scope>

      </dependency>

       

      The missing class OSGiDeploymentAttachment can be found in the artifact jboss-as-osgi-service:7.1.1.Final, which is a sub-dependency of jboss-as-arquillian-container-managed.

       

      My Testclass looks like this:

       

      @RunWith(Arquillian.class)

      public class OrganisationServiceTestWithArquillian

      {

         

          @Inject

          private OrganisationService organisationService;

         

          @Deployment

          public static Archive<?> createDeployment() {

              WebArchive deployment = ShrinkWrap.create(WebArchive.class,"OrganisationServiceTest.war")

                      .addPackage(OrganisationService.class.getPackage())

                      .addPackage(Organisation.class.getPackage())

                      .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")

                      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                      .addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)

                                      .goOffline()

                                      .loadMetadataFromPom("pom.xml")

                                      .artifacts("com.mysema.querydsl:querydsl-jpa")

                                      .resolveAsFiles());

              return deployment;

          }

       

          @Test

          public void testAddOrganisation()

          {

                //testcode

          }

       

      I would very much appreciate it if anyone could help me with this. If you need any more information, just let me know.

       

      Thanks in advance,

      Luke