Can´t run Arquillian tests with a Glassfish managed profile

I am trying to run Arquillian tests with a glassfish managed profile, but I still canĀ“t get it working.

My Profile in the POM is the following:

       <profile>
                    <id>glassfish-managed</id>
                    <activation>
                           <activeByDefault>true</activeByDefault>
                    </activation>
                    <dependencies>
                            <dependency>
                                  <groupId>org.jboss.arquillian.container</groupId>
                                  <artifactId>arquillian-glassfish-managed-3.1</artifactId>
                                  <version>${arquillian-glassfish.version}</version>
                                 <scope>test</scope>
                           </dependency>
                    </dependencies>
                    <build>
                           <testResources>
                                 <testResource>
                                       <directory>src/test/resources</directory>
                                 </testResource>
                            </testResources>
                           <plugins>
                                  <plugin>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <executions>
                                               <execution>
                                                      <id>setup-glassfish</id>
                                                      <phase>process-test-classes</phase>
                                                      <configuration>
                                                            <artifactItems>
                                                                  <artifactItem>

                         <groupId>org.glassfish.main.distributions</groupId>

                         <artifactId>glassfish</artifactId>

                         <version>${glassfish.version}</version>
                                                                                                                                <outputDirectory>${project.build.directory}   
                          </outputDirectory>
                                                                   </artifactItem>
                                                            </artifactItems>
                                                      </configuration>
                                               </execution>
                                        </executions>
                                  </plugin>
                           </plugins>
                     </build>
             </profile>

In the arquillian.xml file:

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

    <container qualifier="glassfish-managed" default="true">
        <configuration>
            <property name="glassFishHome">C:\glassfish4</property>
            <property name="adminHost">localhost</property>
            <property name="adminPort">4848</property>
                        <property name="adminUser">admin</property>
            <property name="adminPassword">admin</property>
        </configuration>
    </container>

In the glassfish-resources.xml file:

<resources>
       <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool"
                      jndi-name="java:app/jdbc/arquillian"/>
        <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool"
                             res-type="javax.sql.DataSource"
                             datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
                             is-isolation-level-guaranteed="false">
             <property name="databaseName" value="memory:offine-product-mapper;create=true"/>
             <property name="user" value="APP"/>
             <property name="password" value="APP"/>
        </jdbc-connection-pool>
</resources>

What I get in the console is: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor...

Thank you.

Answers


The problem was that I had two profiles set as default in the arquillian.xml file ( with default="true").


Need Your Help

How to remove spaces and newlines in a string

c# asp.net replace trim

sorry if they are not very practical for C # Asp.Net, I hope to make me understand