[rules-users] Drools Flow JPA persistence error while Connecting to MySql Database.

Mauricio Salatino salaboy at gmail.com
Fri Oct 23 09:37:46 EDT 2009


Hmm.. that's weird.. I have it working here..
Did you change the MySQL Driver? or something in the pom.xml file?
with which version of MySQL are you working?


2009/10/22 <Pardeep.Ruhil at lntinfotech.com>

>
> Hi,
> I am trying to run the project given at
> http://blog.athico.com/2009/09/drools-flow-variable-persistence.html.
> I am successfully able to run the same in default H2 database, but when I
> am trying to run the project, taking Mysql database for persistence. I am
> not able to run the demo project as i m getting this error.
>
>
> ct 23, 2009 8:54:25 AM org.hibernate.impl.SessionFactoryObjectFactory
> addInstance
> INFO: Not binding factory to JNDI, no JNDI name configured
> Oct 23, 2009 8:54:25 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
> INFO: Running hbm2ddl schema export
> Oct 23, 2009 8:54:25 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
> INFO: exporting generated schema to database
> Oct 23, 2009 8:54:26 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
> INFO: schema export complete
> Oct 23, 2009 8:54:26 AM bitronix.tm.BitronixTransactionManager logVersion
> INFO: Bitronix Transaction Manager version 1.3.2
> Oct 23, 2009 8:54:26 AM bitronix.tm.Configuration buildServerIdArray
> WARNING: cannot get this JVM unique ID. Make sure it is configured and you
> only use ASCII characters. Will use IP address instead (unsafe for
> production usage!).
> Oct 23, 2009 8:54:26 AM bitronix.tm.Configuration buildServerIdArray
> INFO: JVM unique ID: <172.17.88.140>
> Oct 23, 2009 8:54:27 AM bitronix.tm.journal.DiskJournal open
> WARNING: active log file is unclean, previous server crash ?
> Oct 23, 2009 8:54:27 AM bitronix.tm.recovery.Recoverer run
> INFO: recovery committed 0 dangling transaction(s) and rolled back 0
> aborted transaction(s) on 1 resource(s) [jdbc/testDS1]
> Fri Oct 23 08:54:27 IST 2009 DEBUG: Executing XA statement: XA START
> 0x3137322e31372e38382e313430000001247f6c815f00000000,0x3137322e31372e38382e313430000001247f6c81ad00000002,0x42746e78
> Fri Oct 23 08:54:27 IST 2009 DEBUG: Executing XA statement: XA END
> 0x3137322e31372e38382e313430000001247f6c815f00000000,0x3137322e31372e38382e313430000001247f6c81ad00000002,0x42746e78
> Fri Oct 23 08:54:27 IST 2009 DEBUG: Executing XA statement: XA COMMIT
> 0x3137322e31372e38382e313430000001247f6c815f00000000,0x3137322e31372e38382e313430000001247f6c81ad00000002,0x42746e78
> ONE PHASE
> Kession id is1
> Session object
> isorg.drools.process.command.impl.CommandBasedStatefulKnowledgeSession at 152b6f5
> ### Starting process ###
> Fri Oct 23 08:54:28 IST 2009 DEBUG: Executing XA statement: XA START
> 0x3137322e31372e38382e313430000001247f6c81fb00000007,0x3137322e31372e38382e313430000001247f6c821b00000009,0x42746e78
> x Ac = SomeString
> y = VARIABLE: null - This is a test Entity
> z = Serializable Variable: This is a test SerializableObject
> Fri Oct 23 08:54:28 IST 2009 DEBUG: Executing XA statement: XA END
> 0x3137322e31372e38382e313430000001247f6c81fb00000007,0x3137322e31372e38382e313430000001247f6c821b00000009,0x42746e78
> Fri Oct 23 08:54:28 IST 2009 DEBUG: Executing XA statement: XA COMMIT
> 0x3137322e31372e38382e313430000001247f6c81fb00000007,0x3137322e31372e38382e313430000001247f6c821b00000009,0x42746e78
> ONE PHASE
> ### Retrieving process instance ###
> Fri Oct 23 08:54:28 IST 2009 DEBUG: Executing XA statement: XA START
> 0x3137322e31372e38382e313430000001247f6c82880000000e,0x3137322e31372e38382e313430000001247f6c828800000010,0x42746e78
> AUTO
> Oct 23, 2009 8:54:28 AM org.hibernate.util.JDBCExceptionReporter
> logExceptions
> WARNING: SQL Error: 0, SQLState: null
> Oct 23, 2009 8:54:28 AM org.hibernate.util.JDBCExceptionReporter
> logExceptions
> SEVERE: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection
> from datasource jdbc/testDS1 in state ACCESSIBLE wrapping
> com.mysql.jdbc.jdbc2.optional.MysqlXAConnection at 126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper at 1a1b2f
> Oct 23, 2009 8:54:28 AM org.hibernate.event.def.DefaultLoadEventListener
> onLoad
> INFO: Error performing load command
> *org.hibernate.exception.GenericJDBCException*: could not load an entity:
> [org.drools.persistence.session.SessionInfo#1]
>         at
> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(*
> SQLStateConverter.java:126*)
>         at org.hibernate.exception.SQLStateConverter.convert(*
> SQLStateConverter.java:114*)
>         at org.hibernate.exception.JDBCExceptionHelper.convert(*
> JDBCExceptionHelper.java:66*)
>         at org.hibernate.loader.Loader.loadEntity(*Loader.java:1895*)
>         at org.hibernate.loader.entity.AbstractEntityLoader.load(*
> AbstractEntityLoader.java:71*)
>         at org.hibernate.loader.entity.AbstractEntityLoader.load(*
> AbstractEntityLoader.java:65*)
>         at org.hibernate.persister.entity.AbstractEntityPersister.load(*
> AbstractEntityPersister.java:3072*)
>         at
> org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(*
> DefaultLoadEventListener.java:434*)
>         at org.hibernate.event.def.DefaultLoadEventListener.doLoad(*
> DefaultLoadEventListener.java:415*)
>         at org.hibernate.event.def.DefaultLoadEventListener.load(*
> DefaultLoadEventListener.java:165*)
>         at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(*
> DefaultLoadEventListener.java:223*)
>         at org.hibernate.event.def.DefaultLoadEventListener.onLoad(*
> DefaultLoadEventListener.java:126*)
>         at org.hibernate.impl.SessionImpl.fireLoad(*SessionImpl.java:905*)
>         at org.hibernate.impl.SessionImpl.get(*SessionImpl.java:842*)
>         at org.hibernate.impl.SessionImpl.get(*SessionImpl.java:835*)
>         at org.hibernate.ejb.AbstractEntityManagerImpl.find(*
> AbstractEntityManagerImpl.java:182*)
>         at
> org.drools.persistence.session.SingleSessionCommandService.<init>(*
> SingleSessionCommandService.java:153*)
>         at
> org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.loadStatefulKnowledgeSession(
> *JPAKnowledgeServiceProviderImpl.java:75*)
>         at
> org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(
> *JPAKnowledgeService.java:102*)
>         at org.plugtree.labs.VariablePersistenceStrategiesTest.testApp(*
> VariablePersistenceStrategiesTest.java:158*)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(*Native Method*)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(*TestCase.java:154*)
>         at junit.framework.TestCase.runBare(*TestCase.java:127*)
>         at junit.framework.TestResult$1.protect(*TestResult.java:106*)
>         at junit.framework.TestResult.runProtected(*TestResult.java:124*)
>         at junit.framework.TestResult.run(*TestResult.java:109*)
>         at junit.framework.TestCase.run(*TestCase.java:118*)
>         at junit.framework.TestSuite.runTest(*TestSuite.java:208*)
>         at junit.framework.TestSuite.run(*TestSuite.java:203*)
>         at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(*
> JUnit3TestReference.java:130*)
>         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(*
> TestExecution.java:38*)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> *RemoteTestRunner.java:460*)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> *RemoteTestRunner.java:673*)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(*
> RemoteTestRunner.java:386*)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(*
> RemoteTestRunner.java:196*)
> Caused by: *java.sql.SQLException*: error enlisting a JdbcConnectionHandle
> of a JdbcPooledConnection from datasource jdbc/testDS1 in state ACCESSIBLE
> wrapping com.mysql.jdbc.jdbc2.optional.MysqlXAConnection at 126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper at 1a1b2f
>         at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(*
> JdbcConnectionHandle.java:61*)
>         at bitronix.tm.resource.jdbc.JdbcConnectionHandle.prepareStatement(
> *JdbcConnectionHandle.java:200*)
>         at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(*
> AbstractBatcher.java:534*)
>         at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(*
> AbstractBatcher.java:452*)
>         at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(*
> AbstractBatcher.java:161*)
>         at org.hibernate.loader.Loader.prepareQueryStatement(*
> Loader.java:1573*)
>         at org.hibernate.loader.Loader.doQuery(*Loader.java:696*)
>         at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(*
> Loader.java:259*)
>         at org.hibernate.loader.Loader.loadEntity(*Loader.java:1881*)
>         ... 34 more
> Caused by: *bitronix.tm.internal.BitronixSystemException*: cannot enlist
> an XAResourceHolderState with uniqueName=jdbc/testDS1
> XAResource=com.mysql.jdbc.jdbc2.optional.MysqlXAConnection at 126aaca with
> XID a Bitronix XID [3137322E31372E38382E313430000001247F6C82880000000E :
> 3137322E31372E38382E313430000001247F6C828800000010], error=XAER_OUTSIDE
>         at bitronix.tm.BitronixTransaction.enlistResource(*
> BitronixTransaction.java:83*)
>         at bitronix.tm.resource.common.TransactionContextHelper.enlist(*
> TransactionContextHelper.java:267*)
>         at
> bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(
> *TransactionContextHelper.java:49*)
>         at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(*
> JdbcConnectionHandle.java:59*)
>         ... 42 more
> Caused by: *com.mysql.jdbc.jdbc2.optional.MysqlXAException*: XAER_OUTSIDE:
> Some work is done outside global transaction
>         at
> com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(
> *MysqlXAConnection.java:562*)
>         at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(
> *MysqlXAConnection.java:545*)
>         at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(*
> MysqlXAConnection.java:485*)
>         at bitronix.tm.internal.XAResourceHolderState.start(*
> XAResourceHolderState.java:179*)
>         at bitronix.tm.internal.XAResourceManager.enlist(*
> XAResourceManager.java:89*)
>         at bitronix.tm.BitronixTransaction.enlistResource(*
> BitronixTransaction.java:76*)
>         ... 45 more
>
> When I searched for this exception I got to know that : In MySql for XA
> transactions  For *XA START*<http://dev.mysql.com/doc/refman/5.0/en/xa-statements.html>,
> the JOIN and RESUME clauses are not supported.
> for more details
> http://dev.mysql.com/doc/refman/5.0/en/xa-restrictions.html.
> But in the class org.drools.persistence.session.
> SingleSessionCommandService.java we are using code for join transaction
> *                this*.em.joinTransaction();
>             sessionInfo = *this*.em.find( SessionInfo.*class*, sessionId
> );
>
> So please tell me how to get rid of this exception. Also is there something
> which I have missed for configuation with Mysql database.
> Please help me to get resovle this problem.
>
> Thanks & Regards
> Pardeep Ruhil
> ______________________________________________________________________
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091023/9b7e5ccb/attachment.html 


More information about the rules-users mailing list