now something very strange.
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:]
... 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?
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
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!
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?
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...
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  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.
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.
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").