8 Replies Latest reply on Mar 3, 2015 11:54 AM by rajatsudan

    JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid

    sack4

      I'm new to JBOSS.  I have setup up a JDBC Data source and tested the connection. Test connection was successful.  Now I'm having an issue testing the XA Data source.

      Any help would be appreciated.

      getting the following error message....

      server as7.1

      JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid

       

      below is the setup in my standalone-full.xml

       

      <xa-datasource jndi-name="java:jboss/datasources/webDS_XA" pool-name="webDS_XA" enabled="true" use-ccm="false">
                      <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
                      <xa-datasource-property name="DatabaseName">dtabase01</xa-datasource-property>          
                          <xa-datasource-property name="Username">test</xa-datasource-property>
                          <xa-datasource-property name="Password">xxx</xa-datasource-property>
                          <xa-datasource-property name="ConnectionPoolEnabled">true</xa-datasource-property>
                          <xa-datasource-property name="SourceConnectionTestInterval">600</xa-datasource-property>
                          <driver>as400driverXA</driver>
                          <new-connection-sql>jdbc:as400://shen01;naming=system;errors=full;libraries=, imgtstobj;</new-connection-sql>
                          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                          <xa-pool>
                              <min-pool-size>1</min-pool-size>
                              <max-pool-size>10</max-pool-size>
                              <is-same-rm-override>false</is-same-rm-override>
                              <interleaving>false</interleaving>
                              <pad-xid>false</pad-xid>
                              <wrap-xa-resource>false</wrap-xa-resource>
                          </xa-pool>
                          <security>
                              <user-name>user</user-name>
                              <password>user</password>
                          </security>
                          <validation>
                              <validate-on-match>false</validate-on-match>
                              <background-validation>false</background-validation>
                              <background-validation-millis>0</background-validation-millis>
                          </validation>
                          <statement>
                              <prepared-statement-cache-size>0</prepared-statement-cache-size>
                              <share-prepared-statements>false</share-prepared-statements>
                          </statement>
                      </xa-datasource>
      
                    <drivers>
                          <driver name="h2" module="com.h2database.h2">
                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                          </driver>
                          <driver name="as400driver" module="com.as400database.as400driver">
                              <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
                          </driver>
                          <driver name="as400driverXA" module="com.as400database.as400driver">
                              <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADriver</xa-datasource-class>
                          </driver>
                      </drivers>
      
        • 1. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
          lafr

          The content of <new-connection-sql> does not seem to be a valid SQL-statement.

          • 2. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
            sack4

            I use that same on my non xa data source and it works.  It probably is not correct for an XA Data Source.  I'm looking for an example or documentation on how to setup an JDBC XA Data source. I can not seem to find anything.

             

            none xa data source

             

            <datasource jndi-name="java:jboss/datasources/webDS" pool-name="webDS" enabled="true" use-java-context="true">
                                <connection-url>jdbc:as400://sh01;naming=system;errors=full;libraries=, testlib;</connection-url>
                                <driver>as400driver</driver>
                                <security>
                                    <user-name>test</user-name>
                                    <password&test</password>
                                </security>
                            </datasource>
            
            
            
            • 3. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
              lafr

              You did not understand me.

              <new-connection-sql> needs and SQL statement. This statement is executed when a new connection is established.

              You cannot put your URL in it!!!

              Just comment out the <new-connection-sql> and see what happens.

              • 4. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
                sack4

                I did remove it but I got the same error.  I'm trying to figure out where I can define that same line in an xa data source.

                • 5. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
                  lafr

                  The complete message including a stacktrace might be helpful.

                  What are you missing? The content of the URL for a normal datasource goes into separate fields usually. It all depends on your driver, not on JBoss AS / Wildfly.

                  The driver api show you what is available. See https://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzahh/javadoc/com/ibm/as400/access/AS400JDBCXADataSource.html e.g.

                  <connection-url>jdbc:as400://sh01;naming=system;errors=full;libraries=, testlib;</connection-url>

                  equals to

                  <xa-datasource-property name="ServerName">sh01</xa-datasource-property>

                  <xa-datasource-property name="DatabaseName">?</xa-datasource-property>

                  <xa-datasource-property name="Naming">system</xa-datasource-property>

                  <xa-datasource-property name="Errors">full</xa-datasource-property>

                  <xa-datasource-property name="Libraries">, testlib</xa-datasource-property>

                  ...


                  • 6. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
                    sack4

                    Thanks for your help  I have an application running on Websphere that I'm converting to run on JBOSS Below is complete message with the added.  I I have not finished reading through the link you provided.

                     

                     

                     

                    13:28:36,146 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (HttpManagementService-threads - 13) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:447) [ironjacamar-jdbc-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:385) [ironjacamar-jdbc-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:400) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:630) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:88) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final] at org.jboss.as.connector.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:120) [jboss-as-connector-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.connector.pool.PoolOperations$1.execute(PoolOperations.java:59) [jboss-as-connector-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.connector.pool.PoolOperations.execute(PoolOperations.java:73) [jboss-as-connector-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:461) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:387) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:274) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:202) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:121) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.ModelControllerImpl$1.execute(ModelControllerImpl.java:304) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.controller.ModelControllerImpl$1.execute(ModelControllerImpl.java:294) [jboss-as-controller-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.domain.http.server.DomainApiHandler.processRequest(DomainApiHandler.java:294) at org.jboss.as.domain.http.server.DomainApiHandler.doHandle(DomainApiHandler.java:201) at org.jboss.as.domain.http.server.DomainApiHandler.handle(DomainApiHandler.java:208) at org.jboss.as.domain.http.server.security.SubjectAssociationHandler.handle(SubjectAssociationHandler.java:51) at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78) at org.jboss.sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:69) at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81) at org.jboss.sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:710) at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:78) at org.jboss.as.domain.http.server.RealmReadinessFilter.doFilter(RealmReadinessFilter.java:54) at org.jboss.com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:81) at org.jboss.sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:682) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA] Caused by: javax.resource.ResourceException: No XADataSourceClass supplied! at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:547) [ironjacamar-jdbc-1.0.7.Final.jar:1.0.7.Final] at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:430) [ironjacamar-jdbc-1.0.7.Final.jar:1.0.7.Final] ... 39 more

                    • 7. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
                      lafr

                      Read the complete error until "Caused by: javax.resource.ResourceException: No XADataSourceClass supplied!".

                      So you should add

                      <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADriver</xa-datasource-class>

                      to your xa-datasource and see what happens then.


                      • 8. Re: JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid
                        rajatsudan

                        I had a same problem when I was trying to connect to DB2 database and was able to resolve it by using the latest db jar.

                        Instead of using db2jcc.jar, db2jcc_license_cisuz.jar and db2jcc_license_cu.jar use the latest jar which is db2jcc4.jar

                        So I would recommend you to try with the latest mySql database driver.