1 2 Previous Next 19 Replies Latest reply on Jul 13, 2007 5:25 AM by ysiraj

    4.0.5 to 4.2.0 upgrade and JBossTS

    djr667

      All our 10 datasources are local-tx-datasource but it appears JBossTS (default transaction manager in 4.2.0) only allows 1 local-tx-datasource (not simple to find this out), you need to convert to xa-datasource.

      This should be in the release notes (I can find no reference).

      However, converting to xa-datasource on a Oracle database seems to be problematic. A conclusion I have reached after scanning these forums, scanning Google and trying it out.

      So I switched back to the 'deprecated' "fast in-memory transaction manager" which, in my view, should not be listed as 'deprecated' unless the default TM (JBossTS) supports multiple local-tx-datasource.

      Dave

      P.S. I think that this http://jira.jboss.com/jira/browse/JBAS-4425 is probably also going to screw up Oracle XA on 4.2

        • 1. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
          jhalliday

          There is a config flag for JBossTS to allow multiple last resources. However, it's really not recommended. If you need transactions at all you probably need them to work properly! What are the issues you found when converting to XA?

          • 2. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
            djr667

            I had several problems with XA, namely:

            1. JDBC commit() calls failed with 'use XA commit instead' exceptions in Oracle 9i OCI drivers.

            2. After clicking around in a few apps we would get (cannot remember the exact message) 'unable to reuse connection, transaction outstanding' on a pooled connection.

            None of these problems occur in in 4.0.5 (or modified 4.2.0) when using local transactions. The code base is clean: we never get JBoss 'cleanup your connections' messages, bespoke commt()/rollback() are always called in 'finally' blocks and we use the plain JDBC API for things - plus much of this code has been running OK since JBoss 3.

            After googling etc I came across a JBoss forum post that indicated that the JBossTS transaction service only supports one local-x datasource. Trying to confirm this has been difficult so I have assumed it is true and have disabled JBossTS.

            Dave

            • 3. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
              jhalliday

              The issues you are seeing are consistent with mixing XA and non-XA transactions on the same connection, which earlier versions of Oracle have a problem with. Please check your datasource configuration is as per. http://wiki.jboss.org/wiki/Wiki.jsp?page=IHaveProblemsWithOracleXA
              If it is and you still get these problems, please send me a test case and I'll take a look.

              • 4. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                djr667

                Our Oracle is old (9.0.1.2) and I am pushing for an upgrade (could take a while). I read on Oracle's JDBC site that 9.2 allows local and XA transactions to be mixed.

                In any case we do not need XA transactions, we have a single server which only needs local transactions and all the code is written as such (the older code opens its own connections, does not use JBoss datasources).

                So I need multiple local-tx support.

                Dave

                • 5. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                  dimitris

                  You *can* have multiple 1-phase-commit resources with JBossTS, it's just not recommented.

                  http://wiki.jboss.org/wiki/Wiki.jsp?page=Multiple1PC

                  • 6. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                    djr667

                    OK - but not without extra work on our side.

                    We do not use, nor do we need, two-phase-commit. Why is JBoss 'forcing' us in that direction by labeling the "fast in-memory transaction manager" as deprecated (org.jboss.tm.TransactionManagerService in jboss-service.xml) ?

                    Dave

                    • 7. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                      dimitris

                      What extra work do you mean? Is it not a one-liner setting in the config file of JBossTS?

                      JBossTM is deprecated because JBossTS is a superset in terms of functionality.

                      • 8. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                        djr667

                        Where is the JBossTS config file? I do not see 'allowMultipleLastResources' as a MBean property on TransactionManagerService.

                        Extra work: the phrase "This is transactionally unsafe and should not be relied on" implies that we should modify our legacy systems to use XA transactions and not depend on this option. 'Not recommended' implies we should stop doing it real soon now.

                        Dave

                        • 9. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                          djr667

                          Interesting read
                          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=95617&postdays=0&postorder=asc&start=0
                          unfortunately I still have no idea how to set this 'bad' option.

                          One use-case the above thread seems to ignore is 10 independant completely-ignorant-of-each-other applications each with their own local-tx.

                          Anyhow, I tried setting

                          com.arjuna.ats.jta.allowMultipleLastResources=true
                          in the 'jta' properties in conf/jbossjta-properties.xml (as per http://labs.jboss.com/jbosstm/docs/4.2.3/manuals/html/jta/ProgrammersGuide.html) but get a
                          org.jboss.deployment.DeploymentException: No Attribute found with name: allowMultipleLastResources
                          exception.

                          Am I correct in assuming local-tx-datasources implement the LastResourceCommitOptimisation marker interface ?

                          Or am I barking up the completely wrong tree?

                          Am I really the only person having this problem?

                          Dave

                          P.S. JBossTM really should not be 'deprecated'. The above thread implies it no longer exists in JBoss 5 - this is really unfair.


                          • 10. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                            jhalliday

                            Hi Dave

                            I'm not able to reproduce that error. Please can you post the diff between your bossjta-properties.xml and the original, plus some more information on where the error occurs. I'm assuming it's at the point where your application is deployed, in which case a test application that produces the same behavior may be helpful.

                            • 11. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                              helgaw

                              I am also experiencing this - trying to upgrade from 4.0.4 to 4.2.0 and getting all kinds of transaction issues. - I'm using mysql.

                              I have also read the frequently referenced multiple 1-phase-commit resources wiki, but it would probably be more helpful if it actually stated what setting it is referring to and where it can be found.

                              • 12. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                                jhalliday

                                helgaw, what specifically are the issues you are getting? It's difficult to offer advice without having a clear description of the problem and the environment in which it occurs.

                                • 13. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                                  helgaw

                                  Currently I am getting

                                  java.lang.IllegalArgumentException: object is not an instance of declaring class

                                  while creating entity beans (ejb 2). Reads, updates and deletes seem to work fine.

                                  I have not modifed the jbossjta-properties.xml file but I have moved all my -ds.xml files from

                                  <local-tx-datasource>


                                  to

                                  <xa-datasource>



                                  I would prefer that rather than sticking with the local transactions as that is more of a long term solution.

                                  I am planning to move the system to ejb3 but would prefer not to have to do a big-bang transfer.

                                  My ds file looks like this

                                  <datasources>
                                   <xa-datasource>
                                   <jndi-name>SystemDS</jndi-name>
                                   <xa-datasource-property name="URL">jdbc:mysql://myserver/mydb</xa-datasource-property>
                                   <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                                   <user-name>myusername</user-name>
                                   <password>mypassword</password>
                                   <metadata>
                                   <type-mapping>mySQL</type-mapping>
                                   </metadata>
                                   <min-pool-size>5</min-pool-size>
                                   <max-pool-size>20</max-pool-size>
                                  
                                   <!-- Don't allow connections to hang out idle too long,
                                   never longer than what wait_timeout is set to on the
                                   server...A few minutes is usually okay here,
                                   it depends on your application
                                   and how much spikey load it will see -->
                                  
                                   <idle-timeout-minutes>5</idle-timeout-minutes>
                                   <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                                  
                                   <!-- trying to get XA to work -->
                                   <track-connection-by-tx>true</track-connection-by-tx>
                                   <no-tx-separate-pools/>
                                  
                                   <!-- If you're using Connector/J 3.1.8 or newer, you can use
                                   our implementation of these to increase the robustness
                                   of the connection pool. -->
                                   <exception-sorter-class-name>
                                   com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
                                   </exception-sorter-class-name>
                                   <valid-connection-checker-class-name>
                                   com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
                                   </valid-connection-checker-class-name>
                                   </xa-datasource>
                                  </datasources>
                                  


                                  and I am using mysql-connector 5.0.3 (also tried 5.0.6)

                                  There is no example of a mysql -ds file using xa provided in the docs\examples\jca directories.

                                  Here is a log of what happens:

                                  2007-06-12 13:19:05,637 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobileStyleSheets] Executing SQL: SELECT pageid, device, instance, stylesheet FROM mobilestylesheets WHERE (id=?)
                                  2007-06-12 13:19:05,667 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobileStyleSheets] Executing SQL: SELECT pageid, device, instance, stylesheet FROM mobilestylesheets WHERE (id=?)
                                  2007-06-12 13:19:05,697 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobilePages] Executing SQL: SELECT name, type, reference, owner, url, variant, created, pagetype, faceid FROM mobilepages WHERE (id=?)
                                  2007-06-12 13:19:05,737 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.MobilePages] Executing SQL: SELECT name, type, reference, owner, url, variant, created, pagetype, faceid FROM mobilepages WHERE (id=?)
                                  2007-06-12 13:19:05,777 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.Visit] Executing SQL: INSERT INTO visits (ownerfaceid, page, pagetype, visitorfaceid, visitorip, visitorsession, timestamp, date, userAgent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
                                  2007-06-12 13:19:05,927 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract net.hexia.cia.oem.track.entity.Visit net.hexia.cia.oem.track.entity.VisitHome.create(net.hexia.cia.oem.track.entity.VisitVO) throws javax.ejb.CreateException, causedBy:
                                  java.lang.IllegalArgumentException: object is not an instance of declaring class
                                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                   at java.lang.reflect.Method.invoke(Method.java:585)
                                   at org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand.executeInsert(JDBCMySQLCreateCommand.java:116)
                                   at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:321)
                                   at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:151)
                                   at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:587)
                                   at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:237)
                                   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:225)
                                   at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:625)
                                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                   at java.lang.reflect.Method.invoke(Method.java:585)
                                   at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
                                   at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1126)
                                   at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
                                   at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:203)
                                   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:189)
                                   at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:105)
                                   at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:136)
                                   at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:76)
                                   at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:45)
                                   at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:56)
                                   at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:125)
                                   at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                                   at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:161)
                                   at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:145)
                                   at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:132)
                                   at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
                                   at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:521)
                                   at org.jboss.ejb.Container.invoke(Container.java:981)
                                   at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:359)
                                   at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:133)
                                   at $Proxy565.create(Unknown Source)
                                  


                                  • 14. Re: 4.0.5 to 4.2.0 upgrade and JBossTS
                                    jhalliday

                                    This has the hallmarks of a classloading issue. Is the problem only with xa-datasource? i.e. does the create work ok with local-tx-datasource? If so that would point towards an issue with XA support in the driver.

                                    1 2 Previous Next