我正在尝试使用glassfish管理的配置文件运行Arquillian测试,但我仍然无法使其正常工作。
我在POM中的个人资料如下:
<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>
在arquillian.xml文件中:
<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>
在glassfish-resources.xml文件中:
<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>
我在控制台中获得的是:java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor...
谢谢。
答案 0 :(得分:0)
问题是我在arquillian.xml文件中将两个配置文件设置为默认值(默认值为“true”)。