André
André

Reputation: 2204

Add an XA datasource fails with jboss-as-maven-plugin

I'm having troubles executing this maven build using the jboss-as-maven-plugin when I try to add the XA datasource required for my application.

The error message is very unfriendly. After adding the mysql driver, it executes the command to add the datasource, failing with the message:

 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

This is the root exception being thrown

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

Below the plugin declaration at my 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>

I execute the maven project with the following goals: jboss-as:start install

Upvotes: 0

Views: 566

Answers (1)

James R. Perkins
James R. Perkins

Reputation: 17780

This was a bug and will be fixed in 7.6.Final.

Upvotes: 1

Related Questions