Re: [rules-users] Drools Flow JPA persistence error while Connecting to MySql Database
by Pardeep.Ruhil@lntinfotech.com
Hi Mauricio,
No I haven't change the Mysql driver and neither in the pom.xml file.
Currently I am working on MySql 5.0.9
and driver I am using is mysql-connector-java-5.0.4-bin.
Can you tell me which version of Mysql you are using and the name of the
jar files you are using to run the project.
May there can be a problem in version of some jar files I am using.
Jar files I am using to run the project are :
1. javax.persistence.jar
2. antlr-runtime.jar
3. drools-api.jar
4. drools-compiler.jar
5. drools-core.jar
6. drools-decisiontables.jar
7. drools-jsr94.jar
8. drools-templates.jar
9. joda-time.jar
10. jsr94.jar
11. jxl.jar"
12. mvel2.jar
13. org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
14. xpp3.jar
15. xpp3_min.jar
16. xstream.jar
17. junitperf.jar
18.junit.jar"
19. btm-1.3.2.jar
20. drools-persistence.jar
21. log4j-1.2.15.jar
22. h2-1.0.77.jar"/>
23. javassist.jar"/>
24 hibernate-annotations-3.4.0.GA.jar
25. hibernate-entitymanager-3.4.0.GA.jar
26. dom4j-1.6.1.jar
27. hibernate-commons-annotations-3.1.0.GA.jar
28. commons-logging-1.0.4.jar
29. jta.jar
30. slf4j-jdk14-1.5.2.jar
31. slf4j-api-1.5.2.jar
32. hibernate-core-3.3.1.GA.jar
33. commons-collections-3.2.jar
34. antlr-2.7.5.jar
35. mysql-connector-java-5.0.4-bin.jar
Please tell me if I am using any wrong version of jar files. Also if
possible can you please mail me your configured project with jar files as
I need this demo project working urgently.
Thanks & Regards
Pardeep Ruhil
>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(a)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@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@126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@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
______________________________________________________________________
15 years, 1 month
Re: [rules-users] rules-users Digest, Vol 35, Issue 75
by Pardeep.Ruhil@lntinfotech.com
Hi Mauricio,
No I haven't change the Mysql driver and neither in the pom.xml file.
Currently I am working on MySql 5.0.9
and driver I am using is mysql-connector-java-5.0.4-bin.
Can you tell me which version of Mysql you are using and the name of the
jar files you are using to run the project.
May there can be a problem in version of some jar files I am using.
Jar files I am using to run the project are :
1. javax.persistence.jar
2. antlr-runtime.jar
3. drools-api.jar
4. drools-compiler.jar
5. drools-core.jar
6. drools-decisiontables.jar
7. drools-jsr94.jar
8. drools-templates.jar
9. joda-time.jar
10. jsr94.jar
11. jxl.jar"
12. mvel2.jar
13. org.eclipse.jdt.core_3.4.4.v_894_R34x.jar
14. xpp3.jar
15. xpp3_min.jar
16. xstream.jar
17. junitperf.jar
18.junit.jar"
19. btm-1.3.2.jar
20. drools-persistence.jar
21. log4j-1.2.15.jar
22. h2-1.0.77.jar"/>
23. javassist.jar"/>
24 hibernate-annotations-3.4.0.GA.jar
25. hibernate-entitymanager-3.4.0.GA.jar
26. dom4j-1.6.1.jar
27. hibernate-commons-annotations-3.1.0.GA.jar
28. commons-logging-1.0.4.jar
29. jta.jar
30. slf4j-jdk14-1.5.2.jar
31. slf4j-api-1.5.2.jar
32. hibernate-core-3.3.1.GA.jar
33. commons-collections-3.2.jar
34. antlr-2.7.5.jar
35. mysql-connector-java-5.0.4-bin.jar
Please tell me if I am using any wrong version of jar files. Also if
possible can you please mail me your configured project with jar files as
I need this demo project working urgently.
Thanks & Regards
Pardeep Ruhil
>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(a)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@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@126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@126aaca on
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@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
______________________________________________________________________
15 years, 1 month
Collections of Collections
by Ken Archer
There are certain domains where a collection of objects is itself a member of a different collection of objects (e.g. zips in counties in states, persons in cars at intersections). In these domains, it would be helpful to create LHS conditions on the individual members of the "subcollection". An very hypothetical example of a rule that send direct mail to wealthy zip codes in counties with dealers in states where a business is licensed.
WHEN
$ServiceableState: State (LicensedInState=True)
$CountiesWithDealers: County (DealersInCounty>0) from $ServiceableState.counties
$WealthyZips: Zip (AvgIncome>$100,000) from $CountiesWithDealers.zips //2nd from not allowed
THEN
$WealthyZips.SendDirectMail ()
I know Collect and Accumulate support nested From keywords, but can you nest From keywords themselves to handle collections of collections?
Ken Archer
Telogical Systems
15 years, 1 month
[droolsflow] - one way to use Hibernate mapping with JPAVariablePersister
by Bill Tarr
Here is an alternate version of JPAVariablePersister for people who are already using Hibernate xml mapping files.
This implementation has some downsides, but it seems to be working for now.
I am going to keep using JPA to manage all the Drools Flow tables.
My domain object persistence will be managed by Hibernate Session.
We are also currently using automatic flush (so no code to persist domain objects in this class)
Obviously you need to use your own version of HibUtil.
import java.util.logging.Level;
import java.util.logging.Logger;
import org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable;
import org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo;
import org.drools.persistence.processinstance.persisters.VariablePersister;
import org.drools.runtime.Environment;
import org.hibernate.Session;
import HibUtil;
/**
* Variation on Drools JPA Variable Persister.
* org.drools.persistence.processinstance.persisters.JPAVariablePersister
* for using variables persisted by Hibernate, while still using JPA to
* persist DroolsFlow data.
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
* @author salaboy
*/
public class JPAVariablePersisterHibernate implements VariablePersister {
public VariableInstanceInfo persistExternalVariable(String name, Object o,
VariableInstanceInfo oldValue, Environment env) {
if(o == null || (oldValue != null && oldValue.getPersister().equals(""))){
return null;
}
try {
JPAPersistedVariable result = null;
if (oldValue instanceof JPAPersistedVariable) {
result = (JPAPersistedVariable) oldValue;
}
if (result == null) {
result = new JPAPersistedVariable();
}
Long idValue = geHibIdValue(o);
result.setPersister(this.getClass().getName());
result.setName(name);
result.setEntityId(idValue);
result.setEntity(o);
result.setEntityClass(o.getClass().getCanonicalName());
return result;
} catch (Throwable t) {
Logger.getLogger(JPAVariablePersisterHibernate.class.getName())
.log(Level.SEVERE, null, t);
throw new RuntimeException("Could not persist external variable", t);
}
}
public Object getExternalPersistedVariable(
VariableInstanceInfo variableInstanceInfo, Environment env) {
if(((JPAPersistedVariable) variableInstanceInfo) == null || ((JPAPersistedVariable) variableInstanceInfo).getEntityId() == null){
return null;
}
System.out.println("Restoring JPAPersistedVariable id=" + ((JPAPersistedVariable) variableInstanceInfo).getId() + " entityId=" + ((JPAPersistedVariable) variableInstanceInfo).getEntityId() + " class=" + ((JPAPersistedVariable) variableInstanceInfo).getEntityClass() + " value=" + ((JPAPersistedVariable) variableInstanceInfo).getEntity());
String varType = ((JPAPersistedVariable) variableInstanceInfo).getEntityClass();
Object obj = HibUtil.getCurrentSession().get(varType, ((JPAPersistedVariable) variableInstanceInfo).getEntityId());
HibUtil.closeCurrentSession();
return obj;
}
/**
* Hibernate lookup to get ID column.
* @param o Dto to look up.
* @return Long id.
*/
private Long geHibIdValue(Object o) {
Session session = HibUtil.getCurrentSession();
return (Long) session.getIdentifier(o);
}
}
15 years, 1 month
[droolsflow] JPAKnowledgeService - how do you reload a Session with Processes?
by Bill Tarr
How do I FULLY reload my session with JPAKnowledgeService? Specifically, shouldn't my session still know it's processes after reloading?
I'm using JPAKnowledgeService to persist my sessions and processes, after running, I have the following DB rows:
SessionInfo - 1
ProcessInstanceInfo - 3 (1 ClaimFlow, and 2 subflow DocFlows)
I get a session properly with loadStatefulKnowledgeSession:
StatefulKnowledgeSession session = JPAKnowledgeService.loadStatefulKnowledgeSession( 1, knowledgeBase, null, env );
but this statement returns an empty collection:
Collection<ProcessInstance> instanceCollection = session.getProcessInstances();
There is no key link between @Entity SessionInfo and ProcessInstanceInfo, so that result makes sense.... but shouldn't restoring the session restore the links to the active process within that session?
I can get the processes by id, but I'm not sure grabbing a subflow works in this example, I really want the session:
ProcessInstance processClm = session.getProcessInstance(1);
Is there actually some other way to retrieve the processes from reloaded session?
As always, thanks for the help!
Bill
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
15 years, 1 month
workaround: guvnor repository remote commands using http (bypassing gwt interface)
by Wesley Akio Imamura
workaround: guvnor repository remote commands using http (bypassing
gwt interface)
the commands are passed using serialized java objects.
IN web.xml:
<servlet>
<servlet-name>XptoServlet</servlet-name>
<servlet-class>org.jboss.seam.remoting.gwt.AcecServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XptoServlet</servlet-name>
<url-pattern>/AcecServlet</url-pattern>
</servlet-mapping>
Servlet code:
package org.jboss.seam.remoting.gwt;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.drools.guvnor.client.rpc.DetailedSerializableException;
import org.drools.guvnor.client.rpc.RepositoryService;
import org.drools.guvnor.client.rpc.SecurityService;
import org.drools.guvnor.client.rpc.SessionExpiredException;
import org.jboss.seam.Component;
import org.jboss.seam.annotations.remoting.WebRemote;
import com.google.gwt.user.client.rpc.SerializationException;
import org.drools.guvnor.server.security.SecurityServiceImpl;
/**
*
* @author Wesley Imamura
*/
public class XptoServlet extends HttpServlet {
private static final String GENERIC_FAILURE_MSG = "An error occurred
on the server. Consult server log for details.";
private static final HashMap TYPE_NAMES;
static final Map METHOD_CACHE = new HashMap();
static {
TYPE_NAMES = new HashMap();
TYPE_NAMES.put("Z", boolean.class);
TYPE_NAMES.put("B", byte.class);
TYPE_NAMES.put("C", char.class);
TYPE_NAMES.put("D", double.class);
TYPE_NAMES.put("F", float.class);
TYPE_NAMES.put("I", int.class);
TYPE_NAMES.put("J", long.class);
TYPE_NAMES.put("S", short.class);
}
public final void doPost(HttpServletRequest request,
HttpServletResponse response) {
Throwable caught;
try {
System.out.println("Reading map.");
ObjectInputStream ois = new ObjectInputStream(request.getInputStream());
Map map = (Map) ois.readObject();
ois.close();
System.out.println("Map read.");
String methodName = (String) map.get("methodName");
System.out.println("methodName: " + methodName);
Integer paramCount = (Integer) map.get("paramCount");
System.out.println("paramCount: " + paramCount.intValue());
Class[] paramTypes = new Class[paramCount];
for (int i = 0; i < paramCount; i++) {
String paramClassName = (String) map.get("param" + i + "Type");
System.out.println("paramClassName: " + paramClassName);
try {
paramTypes[i] = getClassOrPrimitiveFromName(paramClassName);
} catch (ClassNotFoundException e) {
throw new SerializationException("Unknown parameter " + i
+ " type '"
+ paramClassName + "'", e);
}
}
Object[] args = new Object[paramCount];
for (int i = 0; i < args.length; i++) {
args[i] = map.get("param" + i + "Value");
if (args[i] != null) {
if (args[i].getClass().getName().equals("java.lang.String"))
System.out.println("GWTRemoteServiceServlet.processCall(). args[" + i
+ "]: " + ((String) args[i]));
else
System.out.println("GWTRemoteServiceServlet.processCall(). args[" + i
+ "]: " + args[i].toString());
}
}
System.out.println("args ok.");
RepositoryService repositoryService = (RepositoryService)
Component.getInstance("org.drools.guvnor.client.rpc.RepositoryService");
System.out.println("repositoryService ok.");
Method method = getMethod(
"org.drools.guvnor.client.rpc.RepositoryService", methodName,
repositoryService.getClass(), paramTypes );
System.out.println("method ok.");
try {
SecurityService securityService = new
SecurityServiceImpl(); // (SecurityService)
Component.getInstance("org.drools.guvnor.client.rpc.SecurityService");
boolean isLogged = securityService.login("admin", "password");
System.out.println("logged in.");
System.out.println("invoking.");
Object result = method.invoke( repositoryService, args );
System.out.println("invoked.");
ReturnedObject returnedObject = new
ReturnedObject(method.getReturnType(), result);
System.out.println("writing response.");
ObjectOutputStream oos = new
ObjectOutputStream(response.getOutputStream());
oos.writeObject(returnedObject);
oos.close();
System.out.println("response wrote.");
} catch (InvocationTargetException e) {
//now in this case, we log, and then repack it as some sort
of a serializable exception
String exName = e.getCause().getClass().getName();
if (exName.endsWith( "NotLoggedInException" )) {
throw new InvocationTargetException(new
SessionExpiredException());
} else {
Throwable cause = e.getCause();
StringWriter sw = new StringWriter();
PrintWriter w = new PrintWriter(sw);
cause.printStackTrace( w );
DetailedSerializableException det = new
DetailedSerializableException("An error occurred executing the
action.", sw.toString());
throw new InvocationTargetException(det);
}
}
response.setContentType("application/binary");
response.setStatus(HttpServletResponse.SC_OK);
return;
} catch (Throwable e) {
e.printStackTrace();
caught = e;
respondWithFailure(response, caught);
}
}
/**
* Called when the machinery of this class itself has a problem, rather than
* the invoked third-party method. It writes a simple 500 message back to the
* client.
*/
private void respondWithFailure(HttpServletResponse response,
Throwable caught) {
ServletContext servletContext = getServletContext();
servletContext.log("Exception while dispatching incoming RPC call", caught);
try {
response.setContentType("text/plain");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write(GENERIC_FAILURE_MSG);
} catch (IOException e) {
servletContext.log(
"sendError() failed while sending the previous failure to the client",
caught);
}
}
private Class getClassOrPrimitiveFromName(String name) throws
ClassNotFoundException {
Object value = TYPE_NAMES.get(name);
if (value != null) {
return (Class) value;
}
return getClassFromName(name);
}
private Class getClassFromName(String name) throws ClassNotFoundException {
return Class.forName(name, false, this.getClass().getClassLoader());
}
private Method getMethod(String serviceName, String methodName,
Class clz, Class[] paramTypes) {
String key = getKey( serviceName, methodName, paramTypes );
if (METHOD_CACHE.containsKey( key )) {
return (Method) METHOD_CACHE.get( key );
} else {
try {
synchronized ( METHOD_CACHE ) {
Method m = findMethod( clz, methodName, paramTypes );
if (m == null) throw new NoSuchMethodException();
METHOD_CACHE.put( key, m );
return m;
}
} catch ( NoSuchMethodException e ) {
throw new SecurityException("Unable to access a service
method called [" + methodName + "] on class [" + clz.getName() + "]
without the @WebRemote attribute. " +
"This may be a hack attempt, or someone simply neglected
to use the @WebRemote attribute to indicate a method as" +
" remotely accessible.");
}
}
}
private String getKey(String serviceName, String methodName, Class[]
paramTypes) {
if (paramTypes == null) {
return serviceName + "." + methodName;
} else {
String pTypes = "";
for ( int i = 0; i < paramTypes.length; i++ ) {
pTypes += paramTypes[i].getName();
}
return serviceName + "." + methodName + "(" + pTypes + ")";
}
}
private Method findMethod(Class clz, String methodName, Class[]
paramTypes ) throws NoSuchMethodException {
if (clz == Object.class) {
return null;
} else {
Method m = clz.getMethod( methodName, paramTypes );
if (isWebRemoteAnnotated( m )) {
return m;
} else {
return findMethod(clz.getSuperclass(), methodName, paramTypes);
}
}
}
private boolean isWebRemoteAnnotated(Method method) {
if (method == null) return false;
return method.getAnnotation( WebRemote.class ) != null;
}
public static class ReturnedObject implements Serializable {
public ReturnedObject(Class type,
Object result) {
this.returnType = type;
this.returnedObject = result;
}
public Class returnType;
public Object returnedObject;
}
}
--
Wesley Akio Imamura
São Paulo - SP - Brazil
15 years, 1 month
Drools Flow JPA persistence error while Connecting to MySql Database.
by Pardeep.Ruhil@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@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@126aaca on
com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@126aaca on
com.mysql.jdbc.jdbc2.optional.ConnectionWrapper@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@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, 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
______________________________________________________________________
15 years, 1 month
Help understanding rule flow
by dbrownell83
Hi,
I am just going through Conway's game of life to understand how this works.
I am using the Eclipse plug-in to make life easier.
I see you can either use the agenda-group style, or the rule-flow style.
Some points of confusion:
1. In killAll.rf, there is "calculate before" and "calculate after", and
they both use ruleFlowGroup="calculate"...
Are ruleFlowGroups set in the XML? (ie. the UI doesn't allow you to edit
this)
2. In generation.rf, there is a splitter and joiner around 'kill' and
'birth'.
However, in the AgendaGroupDelegate.nextGeneration() code, the agenda groups
are 'stacked', such that 'birth' rules will be executed before 'kill' rules.
Is there any real difference here?
Thanks,
--
View this message in context: http://www.nabble.com/Help-understanding-rule-flow-tp26023797p26023797.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 1 month
Templating without usages of Excel or CSV?
by strug
hi!
is there a way to use the templating feature just from within drools?
without the use of excel or csv or java?
i want to have a template-rule and put the placeholder values into two
different packages:
package customer A:
- my-rule-template.drl
- customer-a-data.drl
package customer B:
- my-rule-template.drl
- customer-b-data.drl
the packages are loaded separately, i.e. the rules fire just for one
customer at a time.
regards, leif
--
View this message in context: http://www.nabble.com/Templating-without-usages-of-Excel-or-CSV--tp260124...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 1 month