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
______________________________________________________________________
16 years, 8 months
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.
16 years, 8 months
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.
16 years, 8 months
New DSL question...Interpreting constants...
by Pegram, Macon
Given the following rules (contrived example):
rule "Monetary 1"
when
Currency(typeID in (CurrencyConst.DOLLAR,
CurrencyConst.EURO, CurrencyConst.YEN))
then
insert(new Fact());
end
rule "Monetary 2"
when
Currency(typeID in (CurrencyConst.RUBLES,
CurrencyConst.WON))
then
insert(new Fact());
end
Is it possible to map constant values into a DSL?
So the above rules could be partially rewritten as:
rule "Monetary 1"
when
Currency is one of DOLLAR, EURO, YEN
then
insert(new Fact());
end
rule "Monetary 2"
when
Currency is one of RUBLES, WON
then
insert(new Fact());
end
16 years, 8 months
Recommended permgen settings for Guvnor
by Clint Brown
Hi,
We're using Drools Guvnor 5.0.1 in a production environment, running on
Oracle's OAS10g 10.1.3.3.0 application server. We're experiencing permgen
issues, particularly when doing large imports of rules, archiving, or
compilation of rules.
We initially deployed to production with the following permgen settings:
-XX:MaxPermSize=128M -ms128M -mx256M
Following permgen exceptions, we increased the permgen to :
-XX:MaxPermSize=256M -ms128M -mx256M.
This sustained us for a while, but our assets are ever growing, and again
we're exceeding the permgen space allocated. Can someone recommend
appropriate setting, particularly if you are using Guvnor to this
capacity? Is there a close correlation to the number of assets within
Guvnor to the memory needed, so that we can project our future memory
requirements?
Assets in Guvnor:
~ 1000 rules in 5 decision tables (.xls) in 5 separate packages
~ 125 technical rules (drl)
~ 5 Guided editor rules
Thanks,
Clint
______________________________________________________________________________________
Clint Brown | Programmer Analyst II (Advisors) | o: 512.683.5232 | m:
512.736.6337
16 years, 8 months
DSL questions....
by Pegram, Macon
All,
Given the following rule:
rule "Add ABC123 Feature"
when
not MyFeature(testCD == "ABC123")
UserRequest(someValue == "ABC123_FEATURE")
$eligible : FeatureEligible(testCD == "ABC123")
then
insert(new MyFeature($eligible));
end
I'd like to create a DSL. Notice that "testCD" is the same value.
Is it possible to apply a value captured in a DSL and use it in more
than one condition? In the above scenario we want to see if the user
is eligible for the feature ABC123, and check whether or not that
feature has already been added in working memory.
The DSL version of the rule might look something like:
rule "Add ABC123 Feature"
when
User is eligible for "ABC123"
User requests "ABC123_FEATURE"
then
Add feature
end
Would I need to write the DSL for the "ABC123" piece like this?
[when]User is eligible for "{testCD}"=not MyFeature(testCD ==
"{testCD}") $eligible : FeatureEligible(testCD = "{testCD}")
Or will I always need to create 2 statements?
What are the performance implications of using a DSL? Is there extra
overhead at runtime or does all the interpretation occur at rule
compilation?
Thanks!
Macon
16 years, 8 months
Guvnor Cache Error with Seam
by Robert Morse
Not sure if this is a Seam or Drools issue, but....
Under Seam 2.2.0.GA, JBoss 5.1.0.GA, and Drools 5.0.1.GA and Guvnor,
changes to rules within Guvnor followed by a rule build within Guvnor
doesn't seem to be reflected back to Seam or the associated cache
directory.
Under Seam, I've defined one rule agent as:
<drools:rule-agent name="securityRules"
url="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/cdms...
"
local-cache-dir="/usr/local/jboss/server/default/data/guvnor/cache/"
poll="30"/>
<drools:managed-working-memory
name="securityWorkingMemory" auto-create="true"
rule-base="#{securityRules}" />
Clearing the cache and starting up JBoss, everything works fine. If I
make a rule change in Guvnor, and rebuild the rules, I'll typically get:
08:34:24,343 ERROR [STDERR] RuleAgent(default) INFO (Thu Oct 22
08:34:24 MDT 2009): Applying changes to the rulebase.
08:34:24,343 ERROR [STDERR] RuleAgent(default) EXCEPTION (Thu Oct 22
08:34:24 MDT 2009): null. Stack trace should follow.
08:34:24,343 ERROR [STDERR] java.lang.NullPointerException
08:34:24,343 ERROR [STDERR] at
org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235)
08:34:24,344 ERROR [STDERR] at
org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:366)
08:34:24,344 ERROR [STDERR] at
org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:712)
08:34:24,344 ERROR [STDERR] at
org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:
640)
08:34:24,344 ERROR [STDERR] at
org.drools.agent.PackageProvider.removePackage(PackageProvider.java:44)
08:34:24,344 ERROR [STDERR] at
org.drools.agent.PackageProvider.applyChanges(PackageProvider.java:80)
08:34:24,344 ERROR [STDERR] at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:397)
08:34:24,344 ERROR [STDERR] at org.drools.agent.RuleAgent$2.run
(RuleAgent.java:516)
08:34:24,344 ERROR [STDERR] at java.util.TimerThread.mainLoop
(Timer.java:512)
08:34:24,344 ERROR [STDERR] at java.util.TimerThread.run(Timer.java:
462)
The application will hang indefinitely when calling fireAllRules().
Restarting the server fixes the problem. If I never rebuild the
rules, or restart the server after rebuilding the rules, this problem
never surfaces.
Changing the poll value doesn't appear to alter anything.
The human mind is an iterative processor, it never does anything right
the first time. What it does well is to make improvements on every
iteration (deMarco)
16 years, 8 months
drools engine not working
by Hemanth kumar
hi,
Im working on Drools project.here is my project scenario.
front end : Adobe Flex 3.0 application
server : tomcat 6.x
Drools : 5.0
from flex application i was invoking java class which isin the server
"DroolsTest.java" .
In this i was dynamically creating a class ( Fact ) ,compiling it and
creating a rule ( a simple test rule).
To run the Rule i also created "StatefulKnowledgeSession" in that i added
facts from dynamically compiled class.
up to this point i was succeded.
now when i call ksession.fireAllRules() it is not displaying any message
from rule engine.i have done several trails and no luck...
Added the following JARS in WEB-INF\lib
antlr-runtime-3.1.1.jar
core-3.4.2.v_883_R34x.jar
drools-api-5.0.1.jar
drools-core-5.0.1.jar
drools-decisiontables-5.0.1.jar
mvel2-2.0.10.jar
drools-compiler-5.0.1.jar
xstream-1.3.1.jar
suggest me any ideas .
regards
Hemanth
--
View this message in context: http://www.nabble.com/drools-engine-not-working-tp25987317p25987317.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 8 months