Closed AndriyKalashnykov closed 10 years ago
To be little more specific, mentiond below
<execution>
<id>add-datasource-xa</id>
<phase>install</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<address>subsystem=datasources</address>
<resources>
<resource>
<address>xa-data-source=java:jboss/datasources/ds-xa</address>
<enable-resource>true</enable-resource>
<properties>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<jndi-name>java:jboss/datasources/ds-xa</jndi-name>
<enabled>true</enabled>
<pool-name>ds-xa</pool-name>
<driver-name>ojdbc6-${oracle.connector.java.version}.jar</driver-name>
</properties>
</resource>
<resource>
<address>xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=DatabaseName</address>
<properties>
<value>oradev01</value>
</properties>
</resource>
<resource>
<address>xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=ServerName</address>
<properties>
<value>localhost:30003</value>
</properties>
</resource>
<resource>
<address>xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=User</address>
<properties>
<value>${db.user}</value>
</properties>
</resource>
<resource>
<address>xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=Password</address>
<properties>
<value>${db.password}</value>
</properties>
</resource>
</resources>
</configuration>
</execution>
With following error:
[INFO] --- jboss-as-maven-plugin:7.4.Final:add-resource (add-datasource-xa) @ xa-deploy ---
[DEBUG] Configuring mojo org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:add-resource from plugin realm ClassRealm[plugin>org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final, parent: s
un.misc.Launcher$AppClassLoader@2b1cccce]
[DEBUG] Configuring mojo 'org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:add-resource' with basic configurator -->
DEBUG address = subsystem=datasources
DEBUG force = true
DEBUG hostname = 127.0.0.1
DEBUG port = 9999
DEBUG address = xa-data-source=java:jboss/datasources/ds-xa
DEBUG enableResource = true
DEBUG properties = {driver-name=ojdbc6-11.2.0.3.jar, enabled=true, jndi-name=java:jboss/datasources/ds-xa, pool-name=ds-xa, xa-datasource-class=org.postgresql.xa.PGXADataSource}
DEBUG address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=DatabaseName
DEBUG properties = {value=oradev01}
DEBUG address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=ServerName
DEBUG properties = {value=localhost:30003}
DEBUG address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=User
DEBUG properties = {value=db_user}
DEBUG address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=Password
DEBUG properties = {value=db_password}
DEBUG resources = [org.jboss.as.plugin.deployment.resource.Resource@6467f9ec, org.jboss.as.plugin.deployment.resource.Resource@66492873, org.jboss.as.plugin.deployment.resource.Resou
rce@4cfeca7b, org.jboss.as.plugin.deployment.resource.Resource@6b9f78ba, org.jboss.as.plugin.deployment.resource.Resource@32af3289]
DEBUG settings = org.apache.maven.execution.SettingsAdapter@19fef64
[DEBUG] -- end configuration --
[INFO] Executing goal add-resource on server 127.0.0.1 (127.0.0.1) port 9999.
[DEBUG] No
The issue is here, https://github.com/jbossas/jboss-as-maven-plugin/blob/master/src/main/java/org/jboss/as/plugin/deployment/resource/AddResource.java#L289. The result should first be checked if it's defined, then try to get it as a list. The asList()
cannot be defined on an undefined ModelNode
.
In addition to the code issue, example in the documentation seems to be wrong. My PR should fix both.
Fixed in PR #67
xa-datasource creation fails when following configuration used, also no working example in plugin documentation available (https://docs.jboss.org/jbossas/7/plugins/maven/latest/)
<configuration> <address>subsystem=datasources</address> <resources> <resource> <address>xa-data-source=java:jboss/datasources/postgresDS</address> <enable-resource>true</enable-resource> <properties> </properties> <resources> <resource> <address>xa-datasource-properties=DatabaseName</address> <properties> <value>dbname</value> </properties> </resource> <resource> <address>xa-datasource-properties=ServerName</address> <properties> <value>localhost</value> </properties> </resource> <resource> <address>xa-datasource-properties=User</address> <properties> <value>user</value> </properties> </resource> <resource> <address>xa-datasource-properties=Password</address> <properties> <value>password</value> </properties> </resource> </resources> </resource> </resources> </configuration>