Announcement Announcement Module
Collapse
No announcement yet.
WebSphereUowTransactionManager/XA/JTA - please help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebSphereUowTransactionManager/XA/JTA - please help

    Hi guys,
    I'm really stumped. I set up an Oracle XA Datasource in WAS and I test the connection successfully from within WAS. As soon as I deploy the app and try access the DB it fails with a jdbc connection error.

    The connection details succeed from the 'TEST CONNECTION' inside WAS. Any ideas are most welcome and appreciated, please guys...thanks

    Here is my Spring config.

    <jee:jndi-lookup id="dataSource" jndi-name="eeBridgeXADS" />

    <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphe reUowTransactionManager"/>

    <aop:config>
    <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* *..service.*Manager.*(..))"/>
    </aop:config>

    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="get*" read-only="true"/>
    <tx:method name="*"/>
    </tx:attributes>
    </tx:advice>

    <bean id="jdbcOperations"
    class="org.springframework.jdbc.core.JdbcTemplate" >
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean id="messageDao" class="mine.dao.jdbc.JdbcMessageDao">
    <property name="jdbcOperations" ref="jdbcOperations"/>
    </bean>

    Here is the error I get when trying to make a connection from within the deployed application.
    ------------------------------
    Caused by: org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC Connection; nested exception is java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:82)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:577)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:641)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:670)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:678)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:710)
    at org.appfuse.dao.jdbc.JdbcMessageDao.getNextMessage (JdbcMessageDao.java:64)
    at org.appfuse.service.impl.PersistentMessageAdapterI mpl.removeNext(PersistentMessageAdapterImpl.java:5 5)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.util.MethodInvoker.invoke(Meth odInvoker.java:276)
    at org.springframework.integration.util.NameResolving MethodInvoker.invokeMethod(NameResolvingMethodInvo ker.java:58)
    at org.springframework.integration.message.MethodInvo kingMessageSource.receive(MethodInvokingMessageSou rce.java:84)
    ... 18 more
    Caused by: java.sql.SQLException: invalid arguments in callDSRA0010E: SQL State = null, Error Code = 17,433
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:208)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:236)
    at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:414)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnect ion.java:165)
    at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtension.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:801)
    at oracle.jdbc.pool.OracleDataSource.getPhysicalConne ction(OracleDataSource.java:297)
    at oracle.jdbc.xa.client.OracleXADataSource.getPooled Connection(OracleXADataSource.java:456)
    at oracle.jdbc.xa.client.OracleXADataSource.getXAConn ection(OracleXADataSource.java:143)
    at oracle.jdbc.xa.client.OracleXADataSource.getXAConn ection(OracleXADataSource.java:129)
    at oracle.jdbc.xa.client.OracleXADataSource.getXAConn ection(OracleXADataSource.java:90)
    at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper$1.run(InternalGenericDataStoreHelper.java:92 0)
    at com.ibm.ws.security.util.AccessController.doPrivil eged(AccessController.java:118)
    at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreH elper.getPooledConnection(InternalGenericDataStore Helper.java:957)
    at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooled Connection(WSRdbDataSource.java:1602)
    at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactor yImpl.createManagedConnection(WSManagedConnectionF actoryImpl.java:1217)
    at com.ibm.ejs.j2c.FreePool.createManagedConnectionWi thMCWrapper(FreePool.java:1895)
    at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection (FreePool.java:1570)
    at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.ja va:2338)
    at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrappe r(ConnectionManager.java:910)
    at com.ibm.ejs.j2c.ConnectionManager.allocateConnecti on(ConnectionManager.java:600)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:449)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConn ection(WSJdbcDataSource.java:418)
    at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:113)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:79)
    ... 32 more

  • #2
    The datasource you are using - have you tried prefixing it with java:comp/env/
    then the jndi name specified in WAS admin console?

    For instance I would use jdbc/eeBridgeXADS as the JNDI name in Websphere (so I knew this was a jdbc resource) then in applicationContext I would have...

    Code:
    <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/eeBridgeXADS" />

    Comment


    • #3
      Hi Rowens,

      Thanx for the response, really appreciate the pointer, i will give this a try shortly and report back, thank you!

      Comment


      • #4
        Hi Rowens,

        That unfortunately did not work, now I get a naming error
        Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:"

        Comment


        • #5
          Here is what I found on IBM site, everything is clear except point 4.
          When the application is deployed to an application server, configure a resource provider and resource data source that the Spring application resource reference can use. Can someone give a pointer please?

          Data access and the Spring Framework

          For Spring beans to access a data source, you must configure those beans so that the Spring Framework delegates to, and integrates with, the WebSphereŽ Application Server runtime correctly.

          The Spring framework wraps Spring beans with a container-management layer that, in an enterprise application environment, delegates to the underlying enterprise application runtime. The following sections describe what to consider when you configure Spring beans that access a data source.
          Access to data sources configured in the application server

          For a Spring application to access a resource such as a Java™ Database Connectivity (JDBC) data source, the application must use a resource provider that is managed by the application server. To do this, use the following steps.

          1. During development, configure the WAR module with a resource reference. For example:

          <resource-ref>
          <res-ref-name>jdbc/springdb</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          <res-sharing-scope>Shareable</res-sharing-scope>
          </resource-ref>

          2. For Enterprise JavaBeans™ (EJB) Java archive (JAR) files, declare the same resource reference in each EJB that needs to access the data source.
          3. Use one of the following steps:
          * Declare a data source proxy bean. In the Spring application configuration, declare a proxy bean that references a resource provider that the application server manages. Set the value of the jndiName property to java:comp/env/ followed by the value of res-ref-name property that you declared in the resource reference. For example:

          <bean id="wasDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
          <property name="jndiName" value="java:comp/env/jdbc/springdb"/>
          <property name="lookupOnStartup" value="false"/>
          <property name="cache" value="true"/>
          <property name="proxyInterface" value="javax.sql.DataSource"/>
          </bean>

          * Alternatively, for Spring Framework Version 2.5 or later, use the <j2ee:jndi-lookup/> approach. Set the value of the jndi-name property to the value of the res-ref-name property that you declared in the resource reference, and the value of the resource-ref property to true. For example:

          <jee:jndi-lookup id=" wasDataSource "
          jndi-name="jdbc/springdb"
          cache="true"
          resource-ref="true"
          lookup-on-startup="false"
          proxy-interface="javax.sql.DataSource"/>

          The Spring application can then use the data source proxy bean as appropriate.
          4. When the application is deployed to an application server, configure a resource provider and resource data source that the Spring application resource reference can use. The resource reference that is declared in the deployment descriptor of the module will be bound to the configured data source of the application server during deployment.

          Comment


          • #6
            turns out it wasnt finding my DS because I configured the DS under node1 and deployed to server1. This is a clustered environment, and so I recreated the DS under cell1, node 1, server 1 and deployed the app to server1, now it is working.

            Now I have some XA issues, some errors are blowing out of WAS. It looks like I may have to chop my transaction lifecycle to see which one is causing a rollback

            Comment

            Working...
            X