[英]Add an XA datasource fails with jboss-as-maven-plugin
當嘗試添加應用程序所需的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
這是一個錯誤,將在7.6.Final中修復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.