1 2 3 Previous Next 39 Replies Latest reply on Jan 24, 2013 9:11 AM by hypheng Go to original post
      • 15. Re: Jboss7.1 arjuna configuration
        mmusgrov

        BTW mysql is not XA compliant and recovery is poorly supported. You should go for a database which does provide good XA support such as postgresql or oracle or db2 etc

        • 16. Re: Jboss7.1 arjuna configuration
          als

          now something very strange.

          I got

          Caused by: java.lang.NoClassDefFoundError: com/mysql/jdbc/jdbc2/optional/MysqlXAConnection

                  at com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.wrapConnection(MysqlXADataSource.java:73) [mysql-connector-java-5.1.6.jar:]

                  at com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.getXAConnection(MysqlXADataSource.java:60) [mysql-connector-java-5.1.6.jar:]

                  at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:430)

                  ... 30 more

          when deploying my EAR.

          I addded mysql-connector-java-5.1.6.jar in EAR, in modules of JBOSS , in lib of Standalone  - and it still doesnt see it.

          What to do?

          • 17. Re: Jboss7.1 arjuna configuration
            mmusgrov

            mysql is not JDBC4 compliant so you can't just drop the driver into the deploy directory - you need to deploy it inside an AS7 module

            • 18. Re: Jboss7.1 arjuna configuration
              tomjenkinson

              Michael Musgrove wrote:

               

              BTW mysql is not XA compliant and recovery is poorly supported. You should go for a database which does provide good XA support such as postgresql or oracle or db2 etc

               

              +1: http://bugs.mysql.com/bug.php?id=12161

               

              If you want to go Open Source (which is only natural) I would suggest PostgreSQL, if you follow the cmt quickstart you will be up and running in no time!

              • 19. Re: Jboss7.1 arjuna configuration
                als

                but as I said I deployed it to C:\jboss\jboss-as-7.1.1.Final\modules\com\mysql\main directory via module.xml.

                • 20. Re: Jboss7.1 arjuna configuration
                  als

                  currently we are using Mysql. all the issue is very strange- all what I want is to make a db connection when one EJB  calls other.

                  Seems that for that I was needed to go to XA, now you say that MySQL is not compliant?

                  Maybe it just a JBOSS critical bug that not permits to open a DB Connection when one EJB Calls another via Local interface?

                  • 21. Re: Jboss7.1 arjuna configuration
                    tomjenkinson

                    Hi Alexey,

                     

                    The issue with MySQL is recovery, you should check out that link I sent. MySQL will operate that way with any application server as it is a bug in MySQL.

                     

                    Tom

                    • 22. Re: Jboss7.1 arjuna configuration
                      mmusgrov

                      Your use case must involve 2 resources otherwise the transaction manager would not complain about multiple last resources.

                       

                      I am still not convinced there is any bug here. Could you slim down your app and post the source (as a tar or zip) here so that we can try to duplicate your issue.

                       

                      Thanks

                      • 23. Re: Jboss7.1 arjuna configuration
                        tomjenkinson

                        I am also not convinced there is a bug here. If the datasource is not defined as an xa-datasource then AS7 will wrap it as a LastResource, Alexey definitely has to make that change.

                         

                        As to the question of where the second resource is coming from, perhaps the EJB container registers a last resource also when transactions flow between EJBs, to do its bookkeeping but I am not altogether positive, anyway, without making that MySQL datasource an xa-datasource you wont get very far.

                         

                        However, the bug with MySQL is real, so I would definitely reconsider the use of MySQL...

                        • 24. Re: Jboss7.1 arjuna configuration
                          robbert1

                          For future references:

                          the short answer would be to use @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) on any EJB method that gets called from other beans that uses another datasources (i.e. a local call from another bean from another ear).

                           

                          • 25. Re: Jboss7.1 arjuna configuration
                            als

                            Guys, I am really sorry for emotions, but this is a most ugly bug in my life that I saw and I am dealing with JBoss for 11 years.

                             

                            We still got

                            "

                            15:25:00,067 WARN  [com.arjuna.ats.arjuna] (EJB default - 1) ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@4ff7973e[connectionListener=5548a88e connectionManager=5c14d276 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a000010:3a6b67a2:505715b2:54, node_name=1, branch_uid=0:ffff0a000010:3a6b67a2:505715b2:58, subordinatenodename=null, eis_name=unknown eis name >])), but already have LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@166f8168[connectionListener=51cd136d connectionManager=7298de59 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a000010:3a6b67a2:505715b2:54, node_name=1, branch_uid=0:ffff0a000010:3a6b67a2:505715b2:56, subordinatenodename=null, eis_name=unknown eis name >]))

                            15:25:00,077 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 1) SQL Error: 0, SQLState: null

                            15:25:00,078 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 1) javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@5548a88e[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@27e515cc connection handles=0 lastUse=1347884700077 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@30fa188a pool internal context=SemaphoreArrayListManagedConnectionPool@7073ae38[pool=MySqlDS] xaResource=LocalXAResourceImpl@4ff7973e[connectionListener=5548a88e connectionManager=5c14d276 warned=false currentXid=null] txSync=null]

                            15:25:00,079 INFO  [org.hibernate.dialect.Dialect] (EJB default - 2) HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect

                            15:25:00,089 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (EJB default - 2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4

                            15:25:00,090 ERROR [stderr] (EJB default - 1) javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection"

                            We use JPA/Hibernate/EntityManager and, yes, MySQL.

                            Going to Postgres is a hard option, since you need to redo all your Hibernate queries.

                            The only thing that we could do is to use MySQL Hibernate only from one Session EJB and from others we use direct connections (not via JBoss connection pool (!!!)).This is a most ugly thing that I ever saw in J2EE systems.

                            I cant understand why you cant do some workaround inside JBoss, why you are blaming MySQL for not supporting XA recovery..So what? I can open 200 connections to MySQL simultaneosly from different apps.So why there is no way to open db connections when two timer  EJBs are connecting by local connection a simple Session EJB???

                            @Transaction attribute didnt help at all.

                             

                            To us , this is a showstopper bug and we are a serious company, using JBoss as a core app server for our product.

                            The amount of time that my R&D tried to make a workaround is reallyy.... I am really disapointed....

                            Anybody here could give me a real workaround way for the trouble, except "Go talk to Mysql" or "Transaction attribute should work"?

                             

                            help will be really really appreciated.

                             

                            Regards

                            • 26. Re: Jboss7.1 arjuna configuration
                              mmusgrov

                              Nothing has changed  to convince me that there is a bug here. You need to slim down your application and post the source so that we can duplicate your issue.

                               

                              Note that support for customers without a subscription is best effort - but we will investigate if you can provide a reproducible test case/example.

                              • 27. Re: Jboss7.1 arjuna configuration
                                mmusgrov

                                And if you do decide to post a reproducible test case can you first apply the advice we have already provided in this thread:- the log output you have just posted suggests you are still not using an xa-datasource configuration.

                                • 28. Re: Jboss7.1 arjuna configuration
                                  als

                                  Michael, I cant post our source code, unfortunately.

                                  Do I understand you correctly that there is no xa-datasource for MySQL?

                                  When you say that I am not using xa-datasource, you mean that that I cant do that with MySQL?

                                  • 29. Re: Jboss7.1 arjuna configuration
                                    mmusgrov

                                    I know you can't post your source code but it should be easy enough for you to create a reproducible test case that contains just the minimum needed to show your issue.

                                     

                                    You need to configure an XA capable MySql datasource yourself. We have already explained on this thread why it doesn't work "out of the box" - MySql does not properly support recovery. However, if you really do want to stick with MySql instead of supported datasources such as oracle or postgresql there are lots of resources on the web that show how to do it (for example go to your favourite seach page and type "how to create and manage datasources in as7").