7 Replies Latest reply on Sep 27, 2011 5:57 AM by John Genoese

    NoClassDefFoundError: org/jboss/arquillian/spi/Profile

    Ryan Cuprak Newbie

      Hello,

      I just upgraded to Alpha5 and am getting a NoClassDefFoundError when I go to run my tests.

       

      POM Dependencies:

           <dependencies>

              <dependency>

                  <groupId>org.glassfish</groupId>

                  <artifactId>javax.ejb</artifactId>

                  <version>3.1</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>javax.enterprise</groupId>

                  <artifactId>cdi-api</artifactId>

                  <version>1.0-SP1</version>

                  <scope>compile</scope>

              </dependency>

              <dependency>

                  <groupId>javax</groupId>

                  <artifactId>javaee-web-api</artifactId>

                  <version>6.0</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.1</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

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

                  <artifactId>arquillian-junit</artifactId>

                  <version>1.0.0.Alpha5</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

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

                  <artifactId>arquillian-glassfish-embedded-3.1</artifactId>

                  <version>1.0.0.Alpha5</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.glassfish.extras</groupId>

                  <artifactId>glassfish-embedded-all</artifactId>

                  <version>3.1</version>

                  <scope>test</scope>

              </dependency>

          </dependencies>

       

      Error:

      initializationError(org.ctjava.services.TestSpeakerService)  Time elapsed: 0.005 sec  <<< ERROR!

      java.lang.NoClassDefFoundError: org/jboss/arquillian/spi/Profile

                at java.lang.ClassLoader.defineClass1(Native Method)

                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

                at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

                at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

                at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

                at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:81)

                at org.jboss.arquillian.impl.DeployableTestBuilder.build(DeployableTestBuilder.java:67)

                at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:82)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)

                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)

                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)

                at org.apache.maven.surefire.Surefire.run(Surefire.java:180)

                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:597)

                at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)

                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

      Caused by: java.lang.ClassNotFoundException: org.jboss.arquillian.spi.Profile

                at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                ... 35 more

       


       

      Thanks,

      -Ryan

        • 1. NoClassDefFoundError: org/jboss/arquillian/spi/Profile
          Aslak Knutsen Master

          can you provide the output of mvn dependency:tree ?

          • 2. NoClassDefFoundError: org/jboss/arquillian/spi/Profile
            Andrew Rubinger Master

            Remember that dependency:tree lies in Maven3.

             

            https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes#Maven3.xCompatibilityNotes-DependencyResolution

             

            I debug by running the build w/ "-X" and sorting through the resolution w/ grep.

             

            S,

            ALR

            • 3. Re: NoClassDefFoundError: org/jboss/arquillian/spi/Profile
              Ryan Cuprak Newbie

              On a lark I decided to delete my local repository (rename) and rerun the build. This time I get something different:

               

              Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.959 sec <<< FAILURE!

              initializationError(org.ctjava.services.TestSpeakerService)  Time elapsed: 0.004 sec  <<< ERROR!

              java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/constraints/Pattern$Flag

                        at java.lang.ClassLoader.defineClass1(Native Method)

                        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

                        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

                        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

                        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

                        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

                        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

                        at java.security.AccessController.doPrivileged(Native Method)

                        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

                        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

                        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

                        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                        at java.lang.Class.getDeclaredMethods0(Native Method)

                        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

                        at java.lang.Class.getDeclaredMethods(Class.java:1791)

                        at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:86)

                        at sun.reflect.annotation.AnnotationType$1.run(AnnotationType.java:83)

                        at java.security.AccessController.doPrivileged(Native Method)

                        at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:82)

                        at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)

                        at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)

                        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)

                        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)

                        at java.lang.reflect.Method.declaredAnnotations(Method.java:693)

                        at java.lang.reflect.Method.getAnnotation(Method.java:679)

                        at org.jvnet.hk2.config.Dom.invoke(Dom.java:898)

                        at org.glassfish.config.support.TranslatedConfigView.invoke(TranslatedConfigView.java:119)

                        at $Proxy28.getConfigRef(Unknown Source)

                        at org.glassfish.config.support.DomainXml.decorate(DomainXml.java:142)

                        at org.glassfish.config.support.DomainXml.run(DomainXml.java:133)

                        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.populateConfig(AbstractModulesRegistryImpl.java:176)

                        at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createHabitat(AbstractModulesRegistryImpl.java:158)

                        at com.sun.enterprise.module.bootstrap.Main.createHabitat(Main.java:425)

                        at com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntime.newGlassFish(StaticGlassFishRuntime.java:104)

                        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:115)

                        at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.setup(GlassFishContainer.java:51)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$4.perform(ContainerLifecycleController.java:126)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$4.perform(ContainerLifecycleController.java:106)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:183)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.setupContainer(ContainerLifecycleController.java:105)

                        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:597)

                        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                        at org.jboss.arquillian.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:78)

                        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:597)

                        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                        at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:68)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:61)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:176)

                        at org.jboss.arquillian.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.java:60)

                        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:597)

                        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                        at org.jboss.arquillian.impl.core.EventImpl.fire(EventImpl.java:67)

                        at org.jboss.arquillian.impl.client.ContainerEventController.execute(ContainerEventController.java:54)

                        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:597)

                        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                        at org.jboss.arquillian.impl.core.EventContextImpl.invokeObservers(EventContextImpl.java:98)

                        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:80)

                        at org.jboss.arquillian.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:54)

                        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:597)

                        at org.jboss.arquillian.impl.core.ObserverImpl.invoke(ObserverImpl.java:90)

                        at org.jboss.arquillian.impl.core.EventContextImpl.proceed(EventContextImpl.java:87)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:126)

                        at org.jboss.arquillian.impl.core.ManagerImpl.fire(ManagerImpl.java:106)

                        at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:58)

                        at org.jboss.arquillian.junit.Arquillian.<init>(Arquillian.java:86)

                        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                        at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

                        at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

                        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                        at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

                        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

                        at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

                        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)

                        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)

                        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)

                        at org.apache.maven.surefire.Surefire.run(Surefire.java:180)

                        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:597)

                        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)

                        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

               

               

              Thanks,

              -Ryan

              • 5. Re: NoClassDefFoundError: org/jboss/arquillian/spi/Profile
                Ryan Cuprak Newbie

                Thanks!

                 

                Final working dependency section for anyone running into the same problem in the future:

                 

                   <repositories>
                        <repository>
                            <id>java.net2</id>
                            <name>Repository hosting the jee6 artifacts</name>
                            <url>http://download.java.net/maven/2</url>
                        </repository>
                        <repository>
                            <url>http://download.java.net/maven/2/</url>
                            <id>jsf20</id>
                            <layout>default</layout>
                        </repository>
                        <repository>
                            <id>JBoss</id>
                            <name>JBoss Repository</name>
                            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
                        </repository>
                        <repository>
                            <id>Glassfish</id>
                            <name>Glassfish Repository</name>
                            <url>http://download.java.net/maven/glassfish</url>
                        </repository>
                    </repositories>
                
                <dependencies>
                        <dependency>
                            <groupId>org.jboss.spec</groupId>
                            <artifactId>jboss-javaee-6.0</artifactId>
                            <version>1.0.0.Final</version>
                            <type>pom</type>
                            <scope>provided</scope>
                        </dependency>
                        <dependency>
                            <groupId>junit</groupId>
                            <artifactId>junit</artifactId>
                            <version>4.8.1</version>
                            <scope>test</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.jboss.arquillian</groupId>
                            <artifactId>arquillian-junit</artifactId>
                            <version>1.0.0.Alpha5</version>
                            <scope>test</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.jboss.arquillian.container</groupId>
                            <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                            <version>1.0.0.Alpha5</version>
                            <scope>test</scope>
                        </dependency>
                        <dependency>
                            <groupId>org.glassfish.extras</groupId>
                            <artifactId>glassfish-embedded-all</artifactId>
                            <version>3.1</version>
                            <scope>test</scope>
                        </dependency>
                    </dependencies>
                
                • 6. Re: NoClassDefFoundError: org/jboss/arquillian/spi/Profile
                  John Genoese Newbie

                  Does anyone have the same setup for TestNG/JBoss AS7 ?

                   

                  Thanks.

                  • 7. Re: NoClassDefFoundError: org/jboss/arquillian/spi/Profile
                    John Genoese Newbie

                    Aslak was kind enough to provide my answer in 

                    {message:id=628633}

                    .