我正在尝试使用 jboss 托管服务器和 IBM DB2 数据库进行工作 arquillian 测试。
现在我坚持创建数据源。由于 JBoss 在每次运行时都会解压,因此我尝试将驱动程序和数据源配置添加到 pom.xml 中,以便 Maven 负责在 JBoss 上创建正确的配置,结果部分如下所示:
<profile>
<id>arquillian-jboss-managed</id>
<build>
<plugins>
<!-- JBoss server itself -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<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.1.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- adding datasource -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy-driver</id>
<phase>process-test-classes</phase>
<!-- groupId and artifactId aren't global, I've got jar on defined path -->
<configuration>
<groupId>db2</groupId>
<artifactId>db2cc</artifactId>
<name>db2jcc4.jar</name>
</configuration>
<goals>
<goal>deploy-artifact</goal>
</goals>
</execution>
<execution>
<id>add-datasource</id>
<phase>process-test-resources</phase>
<configuration>
<address>subsystem=datasources,data-source=MyDataSource</address>
<properties>
<connection-url>jdbc:db2://host:port/database</connection-url>
<jndi-name>MyDataSource</jndi-name>
<enabled>true</enabled>
<pool-name>MyDataSource</pool-name>
<user-name>db2inst1</user-name>
<password>pass</password>
<driver-name>db2jcc4.jar</driver-name>
</properties>
</configuration>
<goals>
<goal>add-resource</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
然而我有一个错误:
无法在项目 testrunner 上执行目标 org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:add-resource (add-datasource):无法执行目标添加资源。原因:I/O 错误无法执行操作 '{ "address" => [], "operation" => "read-attribute", "name" => "launch-type" }': java.net.ConnectException: JBAS012144:无法连接到远程://本地主机:9999。连接超时
我想问题是 JBoss 在 Maven 尝试应用配置参数时没有启动,或者根本没有监听所需的端口。
任何帮助是极大的赞赏
提前致谢