6 Replies Latest reply on Sep 30, 2011 11:27 AM by Hez Jing

    ArquillianProxyException only when JUnit's assertion is failed

    Hez Jing Newbie

      Hi

       

      I'm using Arquillian 1.0.0.Alpha5 with JUnit 4.8.2 and GlassFish embedded server.

       

      When I run the following test (which will always fail in testCreateUser()):

      {code}

      @RunWith(Arquillian.class)

      public class UserEjbTest {

       

          @EJB

          private UserEjb userEjb;

       

          @Deployment

          public static JavaArchive createArchive() {

              JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test.jar");

              archive.addClasses(UserEjb.class);

              return archive;

          }

       

          @Test

          public void testCreateUser() {

              // Assert.assertTrue(true) will not cause any exception

              Assert.assertTrue(false);

          }

      }

      {code}

       

      It will throw the following exception:

      {code}

      org.jboss.arquillian.spi.ArquillianProxyException: java.lang.AssertionError :  [Proxied because : Could not find suitable constructor]

                at org.junit.Assert.fail(Assert.java:91)

                at org.junit.Assert.assertTrue(Assert.java:43)

                at org.junit.Assert.assertTrue(Assert.java:54)

      {code}

       

      May I know what this exception means?

        • 2. Re: ArquillianProxyException only when JUnit's assertion is failed
          Hez Jing Newbie

          Thanks Aslak, but that cause another exception:

           

          java.lang.RuntimeException: Could not create a new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor see cause.

                    at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:170)

                    at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)

                    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:72)

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

                    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)

                    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)

                    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.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)

                    at $Proxy0.invoke(Unknown Source)

                    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)

                    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)

                    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

          Caused by: java.lang.reflect.InvocationTargetException

                    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.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

                    ... 14 more

          Caused by: java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/api/DescriptorExporter

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

                    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

                    at java.lang.Class.getConstructor0(Class.java:2699)

                    at java.lang.Class.getConstructor(Class.java:1657)

                    at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createFromImplModelType(DescriptorInstantiator.java:135)

                    at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createFromUserView(DescriptorInstantiator.java:104)

                    at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:58)

                    at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:45)

                    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:55)

                    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.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

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

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

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

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

                    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:260)

                    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)

                    ... 19 more

          Caused by: java.lang.ClassNotFoundException: org.jboss.shrinkwrap.descriptor.api.DescriptorExporter

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

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

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

                    ... 39 more

          Caused by: java.lang.reflect.InvocationTargetException

                    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.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)

                    ... 14 more

          Caused by: java.lang.NoClassDefFoundError: org/jboss/shrinkwrap/descriptor/api/DescriptorExporter

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

                    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

                    at java.lang.Class.getConstructor0(Class.java:2699)

                    at java.lang.Class.getConstructor(Class.java:1657)

                    at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createFromImplModelType(DescriptorInstantiator.java:135)

                    at org.jboss.shrinkwrap.descriptor.api.DescriptorInstantiator.createFromUserView(DescriptorInstantiator.java:104)

                    at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:58)

                    at org.jboss.shrinkwrap.descriptor.api.Descriptors.create(Descriptors.java:45)

                    at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:55)

                    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.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

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

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

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

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

                    at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:260)

                    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:56)

                    ... 19 more

          Caused by: java.lang.ClassNotFoundException: org.jboss.shrinkwrap.descriptor.api.DescriptorExporter

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

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

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

                    ... 39 more

          • 3. Re: ArquillianProxyException only when JUnit's assertion is failed
            Aslak Knutsen Master

            you got some verison conflict somewhere it seems.. can you post your pom.xml?

            • 4. Re: ArquillianProxyException only when JUnit's assertion is failed
              Hez Jing Newbie

              Here is my parent POM:

               

              <project xmlns="http://maven.apache.org/POM/4.0.0"

                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

                                           http://maven.apache.org/maven-v4_0_0.xsd">

                  <modelVersion>4.0.0</modelVersion>

                  <groupId>com.dummy.playground</groupId>

                  <artifactId>playground-parent</artifactId>

                  <version>1.0-SNAPSHOT</version>

                  <packaging>pom</packaging>

                  <modules>

                      <module>playground-ejb</module>

                      <module>playground-entity</module>

                  </modules>

                  <build>

                      <pluginManagement>

                          <plugins>

                              <plugin>

                                  <groupId>org.apache.maven.plugins</groupId>

                                  <artifactId>maven-compiler-plugin</artifactId>

                                  <version>2.3.2</version>

                              </plugin>

                              <plugin>

                                  <groupId>org.apache.maven.plugins</groupId>

                                  <artifactId>maven-ejb-plugin</artifactId>

                                  <version>2.3</version>

                              </plugin>

                          </plugins>

                      </pluginManagement>

                      <plugins>

                          <plugin>

                              <groupId>org.apache.maven.plugins</groupId>

                              <artifactId>maven-compiler-plugin</artifactId>

                              <configuration>

                                  <source>1.6</source>

                                  <target>1.6</target>

                              </configuration>

                          </plugin>

                      </plugins>

                  </build>

                  <properties>

                      <arquillian.version>1.0.0.CR5</arquillian.version>

                      <glassfish.version>3.2-b06</glassfish.version>

                      <hibernate.version>3.6.7.Final</hibernate.version>

                  </properties>

                  <dependencyManagement>

                      <dependencies>

                          <dependency>

                              <groupId>com.dummy.playground</groupId>

                              <artifactId>playground-entity</artifactId>

                              <version>${project.version}</version>

                          </dependency>

                          <dependency>

                              <groupId>org.hibernate</groupId>

                              <artifactId>hibernate-core</artifactId>

                              <version>${hibernate.version}</version>

                          </dependency>

                          <dependency>

                              <groupId>javax.enterprise</groupId>

                              <artifactId>cdi-api</artifactId>

                              <version>1.0</version>

                              <scope>provided</scope>

                          </dependency>

                          <dependency>

                              <groupId>org.glassfish</groupId>

                              <artifactId>javax.ejb</artifactId>

                              <version>${glassfish.version}</version>

                              <scope>provided</scope>

                          </dependency>

                          <dependency>

                              <groupId>junit</groupId>

                              <artifactId>junit</artifactId>

                              <version>4.8.2</version>

                              <scope>test</scope>

                          </dependency>

                          <dependency>

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

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

                              <version>${arquillian.version}</version>

                              <scope>test</scope>  

                          </dependency>

                      </dependencies>

                  </dependencyManagement>

                  <dependencies>

                      <dependency>

                          <groupId>junit</groupId>

                          <artifactId>junit</artifactId>

                          <scope>test</scope>

                      </dependency>

                      <dependency>

                          <groupId>org.slf4j</groupId>

                          <artifactId>slf4j-jdk14</artifactId>

                          <version>1.5.6</version>

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

                  <repositories>

                      <repository>

                          <id>java.net</id>

                          <name>GlassFish Maven Repository</name>

                          <url>http://download.java.net/maven/glassfish</url>

                      </repository>

                      <repository>

                          <id>jboss-public-repository-group</id>

                          <name>JBoss Public Maven Repository Group</name>

                          <url>https://repository.jboss.org/nexus/content/groups/public</url>

                          <layout>default</layout>

                          <releases>

                              <enabled>true</enabled>

                              <updatePolicy>never</updatePolicy>

                          </releases>

                          <snapshots>

                              <enabled>true</enabled>

                              <updatePolicy>never</updatePolicy>

                          </snapshots>

                      </repository>

                  </repositories>

                  <pluginRepositories>

                      <pluginRepository>

                          <id>jboss-public-repository-group</id>

                          <name>JBoss Public Repository Group</name>

                          <url>http://repository.jboss.org/nexus/content/groups/public/</url>

                          <releases>

                              <enabled>true</enabled>

                          </releases>

                          <snapshots>

                              <enabled>true</enabled>

                          </snapshots>

                      </pluginRepository>

                  </pluginRepositories>

              </project>

               

               

              Here is the POM of the playground-ejb project which causing the error:

               

              <project xmlns="http://maven.apache.org/POM/4.0.0"

                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

                                           http://maven.apache.org/maven-v4_0_0.xsd">

                  <modelVersion>4.0.0</modelVersion>

                  <parent>

                      <groupId>com.dummy.playground</groupId>

                      <artifactId>playground-parent</artifactId>

                      <version>1.0-SNAPSHOT</version>

                  </parent>

                  <artifactId>playground-ejb</artifactId>

                  <packaging>ejb</packaging>

                  <build>

                      <plugins>

                          <plugin>

                              <artifactId>maven-ejb-plugin</artifactId>

                              <configuration>

                                  <ejbVersion>3.1</ejbVersion>

                              </configuration>

                          </plugin>

                      </plugins>

                  </build>

                  <dependencies>

                      <dependency>

                          <groupId>com.dummy.playground</groupId>

                          <artifactId>playground-entity</artifactId>

                      </dependency>

                      <dependency>

                          <groupId>javax.enterprise</groupId>

                          <artifactId>cdi-api</artifactId>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>org.glassfish</groupId>

                          <artifactId>javax.ejb</artifactId>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

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

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

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

                  <profiles>

                      <profile>

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

                          <dependencies>

                              <dependency>

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

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

                                  <version>1.0.0.CR1</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>

                      </profile>

                  </profiles>

              </project>

              • 5. Re: ArquillianProxyException only when JUnit's assertion is failed
                Aslak Knutsen Master

                Try putting the arquillian-bom in your dependencyManagement instead of arquillian-junit-container.

                 

                 

                <dependency>
                    <groupId>org.jboss.arquillian</groupId>
                    <artifactId>arquillian-bom</artifactId>
                    <version>${version.arquillian_core}</version>
                    <scope>import</scope>
                    <type>pom</type>
                </dependency>
                

                 

                 

                arquillian-junit-container is included in that bom. That should force the arquillian-glassfish-embedded-3.1 arquillian-core dependencies to be updated to your choosen core v.