10 Replies Latest reply on Apr 24, 2013 11:33 AM by Andriy Kalashnykov

    Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final

    jacobmm Newbie

      Hello,

       

      I am trying to use the jboss-as-maven-plugin to create a XA data source in a running instance of JBoss AS 7.1.1. I am not even able  to get working the documentation example:

       

      https://docs.jboss.org/jbossas/7/plugins/maven/7.1.1.Final/examples/add-resource-example.html

       

      The output error is:

      [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.1.1.Final:add-resource (add-datasource) on project test-project: Could not execute goal add-resource. Reason: Operation failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS010469: At least one xa-datasource-property is required for an xa-datasource"}} -> [Help 1]

      Thanks in advance,

      Jacob

        • 1. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
          Tobias W Newbie

          Different from the example you should put the xa-datasource-properties resources INTO the datasource resource like this:

           

           

          <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>

           

           

          Tobias

          • 2. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
            Andriy Kalashnykov Newbie

            Tried proposed approach wtih version 7.4.Final of jboss-as-maven-plugin - maven failed to deploy xa-datasource.

            Can you please provide functional pom.xml that deploys oracle xa-datasource?

            • 3. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
              Andriy Kalashnykov Newbie

              To be little more specific, mentiond below <execution> fails miserably

              Environment: (Windows 7 x64bit, Maven 3.0.5, Java 1.7, JBoss 7.1.1.Final)

               

               






              <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]   (f) address = subsystem=datasources

              [DEBUG]   (f) force = true

              [DEBUG]   (f) hostname = 127.0.0.1

              [DEBUG]   (f) port = 9999

              [DEBUG]   (f) address = xa-data-source=java:jboss/datasources/ds-xa

              [DEBUG]   (f) enableResource = true

              [DEBUG]   (f) 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]   (f) address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=DatabaseName

              [DEBUG]   (f) properties = {value=oradev01}

              [DEBUG]   (f) address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=ServerName

              [DEBUG]   (f) properties = {value=localhost:30003}

              [DEBUG]   (f) address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=User

              [DEBUG]   (f) properties = {value=db_user}

              [DEBUG]   (f) address = xa-data-source=java:jboss/datasources/ds-xa,xa-datasource-properties=Password

              [DEBUG]   (f) properties = {value=db_password}

              [DEBUG]   (f) 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]   (f) 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 <id> element was found in the POM - Getting credentials from CLI entry

              [INFO] ------------------------------------------------------------------------

              [INFO] BUILD FAILURE

              [INFO] ------------------------------------------------------------------------

              [INFO] Total time: 12.416s

              [INFO] Finished at: Mon Apr 22 18:34:22 EDT 2013

              [INFO] Final Memory: 15M/244M

              [INFO] ------------------------------------------------------------------------

              [ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:add-resource (add-datasource-xa) on project xa-deploy: Could not execute goal add-resource. Reason: Operat

              ion failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS010469: At least one xa-datasource-property is required for an xa

              -datasource"}} -> [Help 1]

              org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:add-resource (add-datasource-xa) on project xa-deploy: Cou

              ld not execute goal add-resource. Reason: Operation failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS010469: At least

              one xa-datasource-property is required for an xa-datasource"}}

                      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)

                      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

                      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

                      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

                      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)

                      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)

                      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)

                      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)

                      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

                      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)

                      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)

                      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:601)

                      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)

                      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)

                      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)

                      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

              Caused by: org.apache.maven.plugin.MojoExecutionException: Could not execute goal add-resource. Reason: Operation failed: {"JBAS014653: Composite operation failed and was rolled back. Steps

              that failed:" => {"Operation step-2" => "JBAS010469: At least one xa-datasource-property is required for an xa-datasource"}}

                      at org.jboss.as.plugin.deployment.resource.AddResource.execute(AddResource.java:136)

                      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

                      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

                      ... 19 more

              Caused by: java.lang.RuntimeException: Operation failed: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS010469: At least one

              xa-datasource-property is required for an xa-datasource"}}

                      at org.jboss.as.plugin.deployment.resource.AddResource.reportFailure(AddResource.java:326)

                      at org.jboss.as.plugin.deployment.resource.AddResource.processResources(AddResource.java:171)

                      at org.jboss.as.plugin.deployment.resource.AddResource.execute(AddResource.java:129)

                      ... 21 more

              [ERROR]

              [ERROR]

              [ERROR] For more information about the errors and possible solutions, please read the following articles:

              [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

              • 4. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                Tobias W Newbie

                Hi Andriy,

                 

                as I said in my first post: you have to put the resources DatabaseName, ServerName, User and Password into(!) the resource for the xa-datasource. Like this (sorry for bad formatting):

                 

                                                <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>

                                                    <resources>

                                                <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>

                                                </resource>

                 

                 

                Hope that helps,

                Tobias

                • 5. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                  Andriy Kalashnykov Newbie

                  Tobias,

                   

                  Thank you for the prompt reply, I see that code snipped i used <resource/address> tag should not contain xa-data-source=java:jboss/datasources/ds-xa, but that's the only difference i see.. I modified pom.xml but error still there.

                   

                  I thnk we can help a lot of people by providing working example, i can send you maven project, perhaps you'll see the root cause right away. Please let me know.

                   

                  Below is the configuraion that still doesn't work:

                   

                   






                  <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>oracle.jdbc.xa.client.OracleXADataSource</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-datasource-properties=DatabaseName</address>

                                                      <properties>

                                                          <value>oradev01</value>

                                                      </properties>

                                                  </resource>

                                                  <resource>

                                                      <address>xa-datasource-properties=ServerName</address>

                                                      <properties>

                                                          <value>localhost:30003</value>

                                                      </properties>

                                                  </resource>

                                                  <resource>

                                                      <address>xa-datasource-properties=User</address>

                                                      <properties>

                                                          <value>${db.user}</value>

                                                      </properties>

                                                  </resource>

                                                  <resource>

                                                      <address>xa-datasource-properties=Password</address>

                                                      <properties>

                                                          <value>${db.password}</value>

                                                      </properties>

                                                  </resource>

                                              </resources>







                  </configuration>





                  </execution>


                  • 6. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                    Tobias W Newbie

                    Andriy, you still didnt put the resources/resource tags at the right place in the xml as I tried to explain in my previous posts. Please try this first.

                    • 7. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                      Andriy Kalashnykov Newbie

                      Tobias,

                       

                      If I understand correctly from you post you suggested to move whole section of <resources> ... </resources> into <properties> <resources> ... </resources> </properties>?

                       

                      I tried that, didntt work, also tried following: doesnt' work either.

                       










                      <properties>


















                      <!--xa-datasource-property name="IfxWAITTIME">10</xa-datasource-property>










                      <xa-datasource-property name="IfxIFXHOST">myhost.mydomain.com</xa-datasource-property>










                      <xa-datasource-property name="PortNumber">1557</xa-datasource-property-->

                       

                       











                      <!--xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:30003/oradev01</xa-datasource-property-->










                      <!--xa-datasource-property name="DatabaseName">oradev01</xa-datasource-property>










                      <xa-datasource-property name="ServerName">localhost:30003</xa-datasource-property>










                      <xa-datasource-property name="User">${db.user}</xa-datasource-property>










                      <xa-datasource-property name="Password">${db.password}</xa-datasource-property>










                      <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
































                      <jndi-name>java:jboss/datasources/ds-xa</jndi-name>










                      <pool-name>ds-xa</pool-name>










                      <driver-name>ojdbc6-${oracle.connector.java.version}.jar</driver-name-->









                      </properties>

                       

                      For unknown reason you still shying away from showing some working code... )))) I appreciate you help though.

                      • 8. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                        Tobias W Newbie

                        No, you have to move the <resources>...</resources> section directly AFTER the <properties>...</properties> section. I will post working code later, but this will be mysql not oracle.

                        • 10. Re: Unable to create a XA data source using jboss-as-maven-plugin 7.1.1.Final
                          Andriy Kalashnykov Newbie

                          Tobias,

                           

                           

                          Worked like a charm. Your are the man!

                           

                          Reall issue with "complex" XA-example on https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/complex-example.html

                           

                          not movin tags in or out, but specifying :

                           

                          ....

                          <resource>

                                                              <address>xa-datasource-properties=DatabaseName</address>

                          ...

                           

                          instead of:

                           

                          ...

                          <resource>

                            <address>xa-data-source=java:jboss/datasources/postgresDS,xa-datasource-properties=DatabaseName</address>

                           

                          Thanks!

                          ...