0 Replies Latest reply on Feb 18, 2014 7:35 AM by Mark Harvey

    Unable to deploy ear in embedded Glassfish

    Mark Harvey Newbie

      Hi Community;

       

      We have a multi-module enterprise Maven project, with the following structure:

       

      •     parent
        • businessLogic
        • dbEntities
        • web
        • integrationTests
        • ear

       

      We use Maven to build to dynamically build the ear.

       

      I am attempting to add another module to hold Arquillian tests (which would replace the integration tests module). I have successfully used the Maven resolver to resolve the ear and am trying to deploy it to "arquillian-glassfish-embedded-3.1". During the deployment I receiving the following errors:

       

      INFO: Network listener https-listener on port 0 disabled per domain.xml
      INFO: Grizzly Framework 1.9.50 started in: 38ms - bound to [0.0.0.0:8181]
      INFO: GlassFish Server Open Source Edition 3.1.2.2 (java_re) startup time : Embedded (631ms), startup services(502ms), total(1,133ms)
      INFO: command add-resources parameters[Ljava.lang.String;@26fc8079 result: PlainTextActionReporterSUCCESSDescription: add-resources AdminCommandnull
          JDBC connection pool dbPool created successfully.
          JDBC resource jdbc/dbPool created successfully.
      
      INFO: Created EjbThreadPoolExecutor with thread-core-pool-size 16 thread-max-pool-size 32 thread-keep-alive-seconds 60 thread-queue-capacity 2147483647 allow-core-thread-timeout false
      INFO: SEC1002: Security Manager is OFF.
      INFO: SEC1010: Entering Security Startup Service
      INFO: SEC1143: Loading policy provider com.sun.enterprise.security.jacc.provider.SimplePolicyProvider.
      INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
      INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
      INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
      INFO: SEC1011: Security Service(s) Started Successfully
      INFO: WEB0169: Created HTTP listener [http-listener] on host/port [0.0.0.0:8181]
      INFO: WEB0171: Created virtual server [server]
      INFO: WEB0172: Virtual server [server] loaded default web module []
      SEVERE: Exception while invoking class com.sun.enterprise.web.WebDeployer prepare method
      WARNING: Error occurred
      SEVERE: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method
      SEVERE: Exception while preparing the app
      SEVERE:
      SEVERE: Exception while preparing the app
      PlainTextActionReporterFAILUREApplication Ear-0.0.1-SNAPSHOT is not deployed on this target [server]Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.469 sec <<< FAILURE! - in org.arquillian.example.GreeterIT
      should_create_greeting(org.arquillian.example.GreeterIT)  Time elapsed: 0.016 sec  <<< ERROR!
      java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.
          at org.jboss.arquillian.protocol.servlet.ServletUtil.determineBaseURI(ServletUtil.java:64)
          at org.jboss.arquillian.protocol.servlet.ServletURIHandler.locateTestServlet(ServletURIHandler.java:60)
          at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:84)
          at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:120)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          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:135)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
          at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:57)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          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.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
          at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
          at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)
          at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)
          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
          at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
          at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
          at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
          at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
          at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
          at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
          at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
          at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
          at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
          at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
          at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
      
      

      Can anyone provide any suggestions on how to resolve this issue? N.B. GreeterIT is expected to fail at this point

       

      pom.xml:

      <build>
              <sourceDirectory>src/main/java</sourceDirectory>
              <resources>
                  <resource>
                      <directory>src/main/resources</directory>
                  </resource>
              </resources>
              <testSourceDirectory>src/test/java</testSourceDirectory>
              <testResources>
                  <testResource>
                      <directory>src/test/resources</directory>
                  </testResource>
                  <testResource>
                      <directory>src/test/resources-glassfish</directory>
                  </testResource>
              </testResources>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <configuration>
                          <source>1.7</source>
                          <target>1.7</target>
                      </configuration>
                  </plugin>
                  <plugin>
                      <artifactId>maven-surefire-plugin</artifactId>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-failsafe-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>integration-test</goal>
                                  <goal>verify</goal>
                              </goals>
                              <configuration>
                                  <testSourceDirectory>src/main/test</testSourceDirectory>
                                  <includes>
                                      <include>**/*IT.java</include>
                                  </includes>
                              </configuration>
                          </execution>
                      </executions>
                      <configuration>
                          <systemPropertyVariables>
                              <java.util.logging.config.file>
                                  ${project.build.testOutputDirectory}/logging.properties
                              </java.util.logging.config.file>
                              <derby.stream.error.file>
                                  ${project.build.directory}/derby.log
                              </derby.stream.error.file>
                          </systemPropertyVariables>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
          <dependencyManagement>
              <dependencies>
                  <dependency>
                      <groupId>org.jboss.shrinkwrap.resolver</groupId>
                      <artifactId>shrinkwrap-resolver-bom</artifactId>
                      <version>2.0.2</version>
                      <scope>import</scope>
                      <type>pom</type>
                  </dependency>
                  <dependency>
                      <groupId>org.jboss.arquillian</groupId>
                      <artifactId>arquillian-bom</artifactId>
                      <version>1.1.2.Final</version>
                      <scope>import</scope>
                      <type>pom</type>
                  </dependency>
              </dependencies>
          </dependencyManagement>
          <dependencies>
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-container</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.container</groupId>
                  <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                  <version>1.0.0.CR4</version>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.glassfish.main.extras</groupId>
                  <artifactId>glassfish-embedded-all</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-core</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.shrinkwrap</groupId>
                  <artifactId>shrinkwrap-api</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.shrinkwrap.resolver</groupId>
                  <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.shrinkwrap.resolver</groupId>
                  <artifactId>shrinkwrap-resolver-api-maven</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.jboss.arquillian.container</groupId>
                  <artifactId>arquillian-container-test-api</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>com.foo.test</groupId>
                  <artifactId>Ear</artifactId>
                  <version>0.0.1-SNAPSHOT</version>
                  <type>ear</type>
              </dependency>
          </dependencies>
      
      

       

      arquillian.xml

      <container qualifier="glassfish-embedded" default="true">
              <configuration>
                  <property name="resourcesXml">
                      src/test/resources-glassfish/glassfish-resources.xml
                  </property>
              </configuration>
          </container>
      
      

       

      glassfish-resources.xml

      <resources>
          <jdbc-resource pool-name="dbPool" jndi-name="jdbc/dbPool"></jdbc-resource>
          <jdbc-connection-pool name="dbPool"
              res-type="javax.sql.DataSource" datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
              is-isolation-level-guaranteed="false">
              <property name="databaseName" value="target/databases/derby" />
              <property name="createDatabase" value="create" />
          </jdbc-connection-pool>
      </resources>
      
      

       

      deployment

      @RunWith( Arquillian.class )
      public class GreeterIT
      {
          @Deployment
          public static EnterpriseArchive createDeployment()
          {
              try
              {
                  File ear = Maven.resolver().resolve(
                          "uk.co.card.cams:Ear:ear:0.0.1-SNAPSHOT" ).withoutTransitivity().asSingleFile();
                  EnterpriseArchive earArchive = ShrinkWrap.createFromZipFile( EnterpriseArchive.class,
                          ear );
                  earArchive.getAsType( WebArchive.class, "/BusinessLogic-0.0.1-SNAPSHOT.jar" ).addAsResource(
                          "test-persistence.xml", "META-INF/persistence.xml" );
      
                  return earArchive;
              }
              catch ( Exception e )
              {
                  e.printStackTrace();
                  throw e;
              }
      
          }
      ...
      }