2 Replies Latest reply on Dec 30, 2015 3:56 AM by champagne

    What does java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive mean ?

    shaundass

      Hi,

      First of all I am a noob with arquillian testing framework and its kind of pretty obvious for me to ask some silly and trivial questions (I saved myself ). I would be really grateful for any help I get in improving my knowledge about arquillian.

      I am stuck very badly in a very simple implementation of an Arquillian test case. I followed  "http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them/7623805#7623805" to add my project jars to maven repository. I am using Glassfish server as my application server. Then I need to write arquillian test cases.

      For that I used the following code

       


      @RunWith(Arquillian.class)

      public class ControllerLoginModuleTest

      {

         @Inject

         private ControllerLoginModule controllerloginmodule;

         private AuthRealm authRealm;

         private  IAccountManagerInternal accountManager;

       

         @Deployment

         public static WebArchive createDeployment()

         { 

          File[] files = Resolvers.use(MavenResolverSystem.class).loadPomFromFile("pom.xml").resolve("com.appdynamics.controllerjars:controllerbeans:1.0.0","com.appdynamics.controllerjars:controllerapi:2.0.0","com.appdynamics.controllerjars:controllerauth:1.0.0")

                    .withTransitivity().as(File.class);

          

            return ShrinkWrap.create(WebArchive.class, "test.war").

            addClasses(ControllerLoginModule.class,AuthRealm.class,IAccountManagerInternal.class).addAsLibraries(files).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

         }

      .

      .

      .

      }

      Basically I am loading some jars which contains Classes Under Test and the classes on which those classes depends. In the end I am trying to create a web archive out of it. Then I try to test that wether object is null or not.

      The issue which I can figure out from the stack trace is the deployment is not able to find the files from Maven. Below is the stack trace observed when I try to run the test case.

      java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive com.appdynamics.auth.ControllerLoginModuleTest.createDeployment()
        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)
        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:94)
        at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:57)
        at org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      .

      .

      .

      .

      .

       

      Below is my pom

       

      <?xml version="1.0" encoding="UTF-8"?>

      <project

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

      xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

       

         <!-- Model Information -->

      <modelVersion>4.0.0</modelVersion>

       

         <!-- Artifact Information -->

        <groupId>com.auth</groupId>

        <artifactId>controller.functionaltest</artifactId>

        <version>1.0.0-SNAPSHOT</version>

      <packaging>pom</packaging>

       

      <!-- Properties -->

      <properties>

        <version.shrinkwrap.resolver>2.0.0-beta-2</version.shrinkwrap.resolver>

        <version.junit>4.11</version.junit>

        <version.arquillian_core>1.0.3.Final</version.arquillian_core>

        <project.basedir>/controller.functionaltest</project.basedir>

        <version.org.jboss.shrinkwrap>1.1.2</version.org.jboss.shrinkwrap>

      </properties>

       

      <!-- Dependency Management -->

      <dependencyManagement>

        <dependencies>

        <dependency>

        <groupId>org.jboss.shrinkwrap.resolver</groupId>

        <artifactId>shrinkwrap-resolver-bom</artifactId>

        <version>${version.shrinkwrap.resolver}</version>

        <scope>import</scope>

        <type>pom</type>

        </dependency>

        <dependency>

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

        <artifactId>arquillian-bom</artifactId>

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

        <type>pom</type>

        <scope>import</scope>

        </dependency>

        </dependencies>

      </dependencyManagement>

       

      <!-- Dependencies -->

      <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>${version.junit}</version>

        <scope>test</scope>

        </dependency>

        <dependency>

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

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

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

        <scope>test</scope>

        </dependency>

        <dependency>

        <groupId>com.controllerjars</groupId>

        <artifactId>commonscollections</artifactId>

        <version>3.2.1</version>

        </dependency>

        <dependency>

        <groupId>com.controllerjars</groupId>

        <artifactId>commonutil</artifactId>

        <version>1.0.0</version>

        </dependency>

       

        <dependency>

        <groupId>com.appdynamics.controllerjars</groupId>

        <artifactId>controllerapi</artifactId>

        <version>2.0.0</version>

        </dependency>

        <dependency>

        <groupId>com.appdynamics.controllerjars</groupId>

        <artifactId>controllerauth</artifactId>

        <version>1.0.0</version>

        </dependency>

        <dependency>

        <groupId>com.appdynamics.controllerjars</groupId>

        <artifactId>controllerbeans</artifactId>

        <version>1.0.0</version>

        </dependency>

       

        <dependency>

        <groupId>org.jboss.shrinkwrap.resolver</groupId>

        <artifactId>shrinkwrap-resolver-depchain</artifactId>

        <type>pom</type>

        <version>${version.shrinkwrap.resolver}</version>

        </dependency>

      </dependencies>

       

      <!-- Repositories -->

      <repositories>

        <repository>

        <id>JBOSS_NEXUS</id>

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

        </repository>

        <repository>

        <releases>

        <enabled>true</enabled>

        <checksumPolicy>ignore</checksumPolicy>

        </releases>

        <snapshots>

        <enabled>false</enabled>

        </snapshots>

        <id>repo</id>

        <url>file://${project.basedir}/src/main/resources</url>

        </repository>

      </repositories>

       

      <!-- Plugin Configuration -->

      <build>

        <finalName>controller.functionaltest</finalName>

       

        <!-- Compiler -->

        <plugins>

        <plugin>

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

        <version>2.3.2</version>

        <configuration>

        <source>1.6</source>

        <target>1.6</target>

        <encoding>UTF-8</encoding>

        </configuration>

        </plugin>

        </plugins>

       

        <!-- Plugin Management -->

        <pluginManagement>

        <plugins>

        <!--This plugin's configuration is used to store Eclipse m2e settings

        only. It has no influence on the Maven build itself. -->

        <plugin>

        <groupId>org.eclipse.m2e</groupId>

        <artifactId>lifecycle-mapping</artifactId>

        <version>1.0.0</version>

        <configuration>

        <lifecycleMappingMetadata>

        <pluginExecutions>

        <pluginExecution>

        <pluginExecutionFilter>

        <groupId>

        org.apache.maven.plugins

        </groupId>

        <artifactId>

        maven-dependency-plugin

        </artifactId>

        <versionRange>[2.1,)</versionRange>

        <goals>

        <goal>unpack</goal>

        </goals>

        </pluginExecutionFilter>

        <action>

        <ignore></ignore>

        </action>

        </pluginExecution>

        </pluginExecutions>

        </lifecycleMappingMetadata>

        </configuration>

        </plugin>

        </plugins>

        </pluginManagement>

      </build>

      <profiles>

        <profile>

        <id>GLASSFISH_REMOTE_3.1_(REST)</id>

        <build>

        <plugins>

        <plugin>

        <artifactId>maven-dependency-plugin</artifactId>

        <extensions>false</extensions>

        <executions>

        <execution>

        <id>unpack</id>

        <phase>process-test-classes</phase>

        <goals>

        <goal>unpack</goal>

        </goals>

        <configuration>

        <artifactItems>

        <artifactItem>

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

        <artifactId>jboss-as-dist</artifactId>

        <version>7.1.3.Final</version>

        <type>zip</type>

        <overWrite>false</overWrite>

        <outputDirectory>~/JBOSS_Managed</outputDirectory>

        </artifactItem>

        </artifactItems>

        </configuration>

        </execution>

        </executions>

        </plugin>

        </plugins>

       

        </build>

        <dependencies>

        <dependency>

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

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

        <version>1.0.0.CR3</version>

        </dependency>

        </dependencies>

        </profile>

        <profile>

        <id>JBOSS_AS_MANAGED_7.X</id>

        <build>

        <plugins>

        <plugin>

        <artifactId>maven-dependency-plugin</artifactId>

        <extensions>false</extensions>

        <executions>

        <execution>

        <id>unpack</id>

        <phase>process-test-classes</phase>

        <goals>

        <goal>unpack</goal>

        </goals>

        <configuration>

        <artifactItems>

        <artifactItem>

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

        <artifactId>jboss-as-dist</artifactId>

        <version>7.1.3.Final</version>

        <type>zip</type>

        <overWrite>false</overWrite>

        <outputDirectory>~/JBOSS_Managed</outputDirectory>

        </artifactItem>

        </artifactItems>

        </configuration>

        </execution>

        </executions>

        </plugin>

        </plugins>

       

        </build>

        <dependencies>

        <dependency>

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

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

        <version>7.1.3.Final</version>

        </dependency>

        </dependencies>

        </profile>

      </profiles>

      </project>

       

       

       

       

      I can't understand where and what I am missing. I have updated the entries for dependencies given in the Can I add jars to maven 2 build classpath without installing them?. Any help is greatly appreciated. Thanks.