1 2 3 Previous Next 31 Replies Latest reply on Feb 1, 2007 12:25 PM by weston.price

    EJB3 - XA datasource - Transactions - XAER_OUTSIDE

    apill

      Weston Price suggested that I move the discussion in the Transaction forum to this one.

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=99740

      Any help on solving the issue in the following thread would be very much appreciated as it prevents me using XA transactions in my application - and as a result no migration to JBoss 5 is possible since it doesn't support multiple local-tx data sources in a JTA transaction.

        • 1. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
          weston.price

          Sorry, I got caught up in other tasks yesterday. Can you please post the contents of both *-ds.xml file(s) here just a reference?

          • 2. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
            apill

             


            <?xml version="1.0" encoding="UTF-8"?>
            <datasources>
            <xa-datasource>
            <jndi-name>PicsDS</jndi-name>
            <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
            <xa-datasource-property name="DatabaseName">zcoreinv</xa-datasource-property>
            <xa-datasource-property name="User">zcoreinv</xa-datasource-property>
            <xa-datasource-property name="Password">zcoreinv</xa-datasource-property>
            <xa-datasource-property name="PortNumber">50000</xa-datasource-property>
            <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
            <xa-datasource-property name="DriverType">4</xa-datasource-property>
            <isSameRM-override-value>false</isSameRM-override-value>
            <track-connection-by-tx/>
            <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
            <metadata>
            <type-mapping>DB2</type-mapping>
            </metadata>
            </xa-datasource>
            </datasources>



            <?xml version="1.0" encoding="UTF-8"?>
            <datasources>
            <xa-datasource>
            <jndi-name>MaximizerDS</jndi-name>
            <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>
            <xa-datasource-property name="DatabaseName">DLBMain</xa-datasource-property>
            <xa-datasource-property name="User">user</xa-datasource-property>
            <xa-datasource-property name="Password">password</xa-datasource-property>
            <xa-datasource-property name="ServerName">serverhost</xa-datasource-property>
            <xa-datasource-property name="XaEmulation">true</xa-datasource-property>
            <track-connection-by-tx/>
            <metadata>
            <type-mapping>MS SQLSERVER2000</type-mapping>
            </metadata>
            </xa-datasource>
            </datasources>



            <?xml version="1.0" encoding="UTF-8"?>
            <datasources>
            <xa-datasource>
            <jndi-name>MapicsDS</jndi-name>
            <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class>
            <xa-datasource-property name="User">user</xa-datasource-property>
            <xa-datasource-property name="Password">password</xa-datasource-property>
            <xa-datasource-property name="ServerName">serverhost</xa-datasource-property>
            <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
            <metadata>
            <type-mapping>DB2/400</type-mapping>
            </metadata>
            </xa-datasource>
            </datasources>


            • 3. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
              apill

              BTW the metadata tags that should surround the type-mapping tags in the datasource were hidden by this forum. If you look at the html souce of this page they are there.

              • 4. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                weston.price

                Ahh, so it is not just DB2, but MSSQL and DB2 on the AS400. Can you turn on trace in your log4j.xml configuration? That might give me some better idea. The setting is already there in the log4.xml file, you just need to uncomment it.

                • 5. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                  weston.price

                  The metadata stuff in your case is meaningless, that's for the old CMP stuff.

                  • 6. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                    apill

                    TRACE logging for everything?

                    • 7. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                      weston.price

                      Try this:

                       <category name="org.jboss.resource">
                       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
                       </category>
                      


                      • 8. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                        weston.price

                        Also, I am not going to be able to look at this much today, so if you can generate the traces that might give me something more to look at.

                        • 9. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                          apill

                          The log is available here..

                          http://devissues.googlepages.com/xaer-outsidelogs

                          Up until the time 2007-01-25 14:54:32,836 in the log is server startup. The rest is the log generated by the call from my application to the EJB.

                          • 10. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                            apill

                            BTW thank you for your help.

                            • 11. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                              weston.price

                              Hmmm...something doesn't look right. Ok, in with the current logs that you posted, what is the code actually doing and what datasources are you accessing? I am just trying to break this apart to get a better handle on what is going on.

                              • 12. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                                apill

                                The code that is causing the error should only be using the datasource named PicsDS (this is the db2 database on linux). It is other EJBs that use the other datasources.

                                The sequence of events are...

                                1. client calls stateless session bean A method getBusinessUnitSubSystemWithInventory()

                                2. getBusinessUnitSubSystemWithInventory() calls through to another stateless session bean B method getUTInventoryNavigatorDAO(). Stateless session bean B was injected into A by the container.

                                3. B creates a new DAO with the Session that was injected by the container into B. This DAO returned to A.

                                4. Stateless session bean A calls getBusinessUnitSubSystemWithInventory() on the DAO which executes a named hibernate query with the Session.

                                5. The result of this query should be returned to the client.

                                It is at the point the query is executed that the exception is thrown.

                                The relevant code for all of this is available in the previous thread,
                                http://www.jboss.com/index.html?module=bb&op=viewtopic&t=99740

                                • 13. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                                  weston.price

                                  Ok, as a simple test can you do the following:

                                  Write a simple SLSB that uses straight JDBC to do the following:

                                  1) Get a connection from the XADataSource that is injected
                                  2) Use the connection to add/delete values from some random table
                                  3) close the connection

                                  Executing this simple test will either confirm or deny that fact. If you cannot do this let me know and I will try and whip something up.

                                  • 14. Re: EJB3 - XA datasource - Transactions - XAER_OUTSIDE
                                    apill

                                    Ok. I've started work on this test but I am leaving work soon so will get back to you tomorrow morning with the result.

                                    1 2 3 Previous Next