当我尝试添加应用程序所需的XA数据源时,使用jboss-as-maven-plugin执行此maven构建时遇到了麻烦。
错误消息非常不友好。添加mysql驱动程序后,它会执行添加数据源的命令,但失败并显示消息:
Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.5.Final:add-resource (add-xa-datasource) on project great-ear: Could not execute goal add-resource. Reason: null
这是抛出的根异常
Caused by: java.lang.IllegalArgumentException
at org.jboss.dmr.ModelValue.asList(ModelValue.java:128)
at org.jboss.dmr.ModelNode.asList(ModelNode.java:1205)
at org.jboss.as.plugin.deployment.resource.AddResource.resourceExists(AddResource.java:289)
at org.jboss.as.plugin.deployment.resource.AddResource.addCompositeResource(AddResource.java:208)
at org.jboss.as.plugin.deployment.resource.AddResource.processResources(AddResource.java:176)
at org.jboss.as.plugin.deployment.resource.AddResource.execute(AddResource.java:139)
... 21 more
在pom.xml
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.5.Final</version>
<executions>
<!-- Undeploy the application on clean -->
<execution>
<id>undeploy</id>
<phase>clean</phase>
<goals>
<goal>undeploy</goal>
</goals>
<configuration>
<ignoreMissingDeployment>true</ignoreMissingDeployment>
</configuration>
</execution>
<!-- Deploy the JDBC library -->
<execution>
<id>deploy-driver</id>
<phase>install</phase>
<configuration>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<name>mysql</name>
</configuration>
<goals>
<goal>deploy-artifact</goal>
</goals>
</execution>
<!-- Add an XA datasource -->
<execution>
<id>add-xa-datasource</id>
<phase>package</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<address>subsystem=datasources</address>
<resources>
<resource>
<address>xa-data-source=RequiredDS</address>
<enableResource>true</enableResource>
<properties>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<jndi-name>java:jboss/datasources/RequiredDS</jndi-name>
<use-java-context>true</use-java-context>
<enabled>true</enabled>
<driver-name>mysql</driver-name>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>600</query-timeout>
<share-prepared-statements>true</share-prepared-statements>
</properties>
<resources>
<resource>
<address>xa-datasource-properties=DatabaseName</address>
<properties>
<value>schema</value>
</properties>
</resource>
<resource>
<address>xa-datasource-properties=ServerName</address>
<properties>
<value>localhost:3306</value>
</properties>
</resource>
<resource>
<address>xa-datasource-properties=User</address>
<properties>
<value>root</value>
</properties>
</resource>
<resource>
<address>xa-datasource-properties=Password</address>
<properties>
<value>root</value>
</properties>
</resource>
</resources>
</resource>
</resources>
</configuration>
</execution>
<!-- Deploy the application on install -->
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
我执行maven项目时有以下目标:jboss-as:start install
答案 0 :(得分:1)
这是一个错误,将在7.6.Final修复。