Drools flow persistence with Oracle, Could not obtain BTM transaction manager instance
by loumimi
Hello,
I crated a sample application to test the persistent of drools workflow. I
tried the example given in the documentation using H2 Db, everything works
fine.
But when I tried to move to Oracle, I have several problems. I resolved the
bug related to entity names when they are longer than 30, but I still have
an other problem with BitronixTransactionManager
Can you please check if I'm missing some things ?
Here's my stack trace
INFO: schema export complete
May 11, 2011 12:50:14 PM bitronix.tm.BitronixTransactionManager logVersion
INFO: Bitronix Transaction Manager version 1.3.2
May 11, 2011 12:50:14 PM 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!).
May 11, 2011 12:50:14 PM bitronix.tm.Configuration buildServerIdArray
INFO: JVM unique ID: <184.51.16.220>
May 11, 2011 12:50:14 PM bitronix.tm.journal.DiskJournal open
WARNING: active log file is unclean, previous server crash ?
javax.persistence.PersistenceException: [PersistenceUnit:
org.drools.persistence.jpa] Unable to build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.sample.ProcessTest.main(ProcessTest.java:52)
Caused by: org.hibernate.HibernateException: Could not obtain BTM
transaction manager instance
at
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:357)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
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
org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
... 8 more
Caused by: bitronix.tm.utils.InitializationException: recovery failed,
cannot safely start the transaction manager
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:65)
at
bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:41)
... 13 more
Caused by: bitronix.tm.recovery.RecoveryException: error running recovery on
resource jdbc/CCOD02 (XAER_RMERR)
at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:191)
at bitronix.tm.recovery.Recoverer.run(Recoverer.java:105)
at
bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:49)
... 14 more
Caused by: javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:626)
at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:74)
at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:39)
at bitronix.tm.recovery.Recoverer.recover(Recoverer.java:230)
at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:185)
... 16 more
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code =
-2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):
[../../../src/share/back/util.c:820]
I overwrote the file persistence.xml of drools-persistence-jpa-5.0.1.jar
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="RESOURCE_LOCAL" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/db</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:xxxx"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="pwd"/>
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
The data source is created with API way :
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/db");
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "user");
ds.getDriverProperties().put("password", "pwd");
ds.getDriverProperties().put("URL",
"jdbc:oracle:thin:@gfxdevdb01.fr.world.xxx:1567:xxxx");
ds.init();
the exception is launched in this line
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"org.drools.persistence.jpa" );
Thanks for your help
Moundir
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-flow-persistence-with-Oracle-Cou...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
Problem (or question) about drools
by Nico ROEDERER
Hi,
I would like to know if it's the correct e-mail list for
problems/questions about Drools ?
If not, what's the correct email, please ?
Thank you.
N.
13 years, 6 months
Question / problem
by Nico ROEDERER
Hi,
I've got a little question. I've got a drl file which contains two rules :
rule "FirstRule"
salience 99
when
$testDrools : TestDroolsDto()
eval ( 1 == 1 )
then
System.out.println("Set my value to 1");
$testDrools.setMyValue("1");
end
rule "SecondRule"
salience 1
when
$testDrools : TestDroolsDto()
eval( $testDrools.getMyValue().equals("") )
then
System.out.println("My Value : " + $testDrools.getMyValue() );
end
Is it normal that in my second rule is verified ?
-> eval( $testDrools.getMyValue().equals("") ) is true
but : System.out.println("My Value : " + $testDrools.getMyValue() );
show me that myValue == 1
Perhaps I did something wrong ?
Thanks for your helping me.
N.
PS : Here is me TestDroolsDto :
public class TestDroolsDto {
private String myValue;
public TestDroolsDto() {
myValue="";
}
public String toString() {
return " --> " + myValue;
}
/**
* @return the myValue
*/
public String getMyValue() {
if ( myValue == null ) {
myValue = "";
}
return myValue;
}
/**
* @param myValue the myValue to set
*/
public void setMyValue( String myValue ) {
this.myValue = myValue;
}
}
13 years, 6 months
Re: [rules-users] Question / problem
by Bruno Freudensprung
You are right; your probably need to set a no-loop atttribute on your rule.
Or, preferably, put additional conditions to the LHS of your FirstRule
(it would probably be the case in a "real-life" rule).
As Wolfgang suggested, take some time to read Drools expert
documentation: I found it very well designed for beginners (like me).
Regards,
Bruno.
Le 12/05/2011 11:19, Nico ROEDERER a écrit :
> Ok, but when I did this, the first rule has no ending.
> If I don't want to, I've got to retract the object, but my second rule
> is never fired.
>
> Should I make two different files ?
>
> Thanks for the help.
> (Sorry for such a poor English writing :( )
>
> Le 12/05/2011 11:12, Bruno Freudensprung a écrit :
>>
>> Hi,
>>
>> In my understanding it is normal. However if you told Drools that
>> your FirstRule modified the $testDrools object, it should no longer
>> be the case:
>>
>> then
>> System.out.println("Set my value to 1");
>> $testDrools.setMyValue("1");
>> update($testDrools);
>>
>> Regards,
>>
>> Bruno.
>>
>>
>> Le 12/05/2011 10:58, Nico ROEDERER a écrit :
>>> Hi,
>>>
>>> I've got a little question. I've got a drl file which contains two
>>> rules :
>>>
>>> rule "FirstRule"
>>> salience 99
>>> when
>>> $testDrools : TestDroolsDto()
>>> eval ( 1 == 1 )
>>> then
>>> System.out.println("Set my value to 1");
>>> $testDrools.setMyValue("1");
>>>
>>> end
>>>
>>> rule "SecondRule"
>>> salience 1
>>> when
>>> $testDrools : TestDroolsDto()
>>> eval( $testDrools.getMyValue().equals("") )
>>> then
>>> System.out.println("My Value : " + $testDrools.getMyValue() );
>>> end
>>>
>>> Is it normal that in my second rule is verified ?
>>> -> eval( $testDrools.getMyValue().equals("") ) is true
>>> but : System.out.println("My Value : " + $testDrools.getMyValue() );
>>> show me that myValue == 1
>>>
>>> Perhaps I did something wrong ?
>>>
>>> Thanks for your helping me.
>>> N.
>>>
>>>
>>>
>>> PS : Here is me TestDroolsDto :
>>> public class TestDroolsDto {
>>> private String myValue;
>>>
>>> public TestDroolsDto() {
>>> myValue="";
>>> }
>>>
>>> public String toString() {
>>> return " --> " + myValue;
>>> }
>>>
>>> /**
>>> * @return the myValue
>>> */
>>> public String getMyValue() {
>>> if ( myValue == null ) {
>>> myValue = "";
>>> }
>>> return myValue;
>>> }
>>>
>>> /**
>>> * @param myValue the myValue to set
>>> */
>>> public void setMyValue( String myValue ) {
>>> this.myValue = myValue;
>>> }
>>> }
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
13 years, 6 months
concatenate 2 dsl rules in dslr
by Saleem Lakhani
Hi,
How do I combine 2 different dsl statements in dslr.
Example in dsl I have;
1. Kid=Parson(age < 15)
2. Adult=Person(age > 21)
Can I write like this in dslr:
Kid or Adult
saleem
13 years, 6 months
Ruleflow exits before reaching END node?!
by jayadev
RULES:
--------
rule "11"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test()
eval(true)
then
System.out.println(myObj.getIntField());
end
rule "12"
no-loop true
ruleflow-group "second-rulesgroup"
when
myObj: Test(intField==12345)
then
System.out.println(myObj.getIntField());
myObj.setStringField("rule_12");
end
rule "13"
no-loop true
ruleflow-group "first-rulesgroup"
when
myObj: Test(intField==0)
then
myObj.setIntField(12345);
update(myObj);
System.out.println("Done with rule 13 "+myObj.getIntField());
end
RULE_FLOW:
---------
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process
drools-processes-5.0.xsd"
type="RuleFlow" name="TestFlow" id="TestFlow"
package-name="abc.def.xyz" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="100" y="100" width="48" height="48" />
<ruleSet id="3" name="Second" x="402" y="102" width="118" height="40"
ruleFlowGroup="second-rulesgroup" />
<end id="4" name="End" x="584" y="98" width="80" height="40" />
<ruleSet id="5" name="First" x="227" y="174" width="121" height="40"
ruleFlowGroup="first-rulesgroup" />
<actionNode id="6" name="Action" x="431" y="217" width="80" height="40"
>
<action type="expression" dialect="mvel"
>System.out.println("here");</action>
</actionNode>
</nodes>
<connections>
<connection from="6" to="3" />
<connection from="3" to="4" />
<connection from="1" to="5" />
<connection from="5" to="6" />
</connections>
</process>
Test:
-----
public class Test {
private Integer intField;
private String stringField;
public Integer getIntField() {
return intField;
}
public void setIntField(Integer intField) {
this.intField = intField;
}
public String getStringField() {
return stringField;
}
public void setStringField(String stringField) {
this.stringField = stringField;
}
}
My input Fact:
--------------
Test myObj = new Test();
myObj.setIntField(0);
When I use the following things work fine. I can see all output messages in
order.
final StatefulKnowledgeSession ksession = kb.newStatefulKnowledgeSession();
//Where kb is the knowledgebase built using the above assets
Output Messages:
-----------------
Done with rule 13 12345
here
12345
12345
When I use the following it exits without any errors, but, output messages
are not as expected!
final StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kb, null, env);
Output Messages:
-------------------
Done with rule 13 12345
I am exhausted trying to figure out what is going wrong... Don't know where
to debug! Let me know if more information is needed. I am using Hibernate,
Spring, BTM transaction Manager.
I stumbled across "JBRULES-2718" and thought maybe this is something
similar? I am using 5.1.0
Thank you!
--
View this message in context: http://drools.46999.n3.nabble.com/Ruleflow-exits-before-reaching-END-node...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
Guvnor service to compile part of a package ?
by Vincent Legendre
Hi all,
I am looking for a clever way to compile only parts of a Guvnor package
according to some criteria on items (categories, metadata ...), but
outside Guvnor if possible.
The main idea starts by the fact that it is a little bit complex for a
business user to manage packages and compilations, and even more if he
has to manage conditional compilations (using selectors) of a single
package to produce multiple KB compiled according to business criterions.
I want to compile automatically some KB according to categories (more
generally asset's fields) with something external to Guvnor. Thus I need
a way to query Guvnor repository with criterion to get either :
- the corresponding ressources (DRL)
- the filtered compiled KB (PKG ressource)
Filtering with DRL (like custom selectors in Guvnor) will be perfect,
using a custom class too.
Is there such service ?
Does the KnowledgeAgent allow filtering (did not see anything in docs) ?
Or do I need to add a new service in Guvnor war directly ?
Thanks!
13 years, 6 months
Drools 5.1 - exception when trying to use incremental KB updates.
by Stephen Mcgruer
Just moved to Drools 5.1, using a Guvnor package as the base for a
Knowledge Base with incremental updating enabled. Our resource is a
Guvnor PKG. We encounter the following error when a snapshot is made:
[2010:08:224 16:08:903:debug] KnowledgeAgent: Diffing: [UrlResource
path='http://localhost:1337/drools-guvnor/org.drools.guvnor.Guvnor/package/TEST...']
[2010:08:224 16:08:935:debug] BinaryResourceDiffProducerImpl:
Comparing [Rule name=Resource Null-Checker, agendaGroup=MAIN,
salience=0, no-loop=false] against [Rule name=Resource Null-Checker,
agendaGroup=MAIN, salience=0, no-loop=false]
Exception in thread "Thread-30" org.drools.RuntimeDroolsException:
java.lang.reflect.InvocationTargetException : [Rule name=Resource
Null-Checker, agendaGroup=MAIN, salience=0, no-loop=false]
at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
at
org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
at
org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
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 org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
... 6 more
Caused by: java.lang.RuntimeException: this MVELReturnValueExpression
must be compiled for equality
at
org.drools.base.mvel.MVELReturnValueExpression.equals(MVELReturnValueExpression.java:123)
at
org.drools.rule.ReturnValueRestriction.equals(ReturnValueRestriction.java:306)
at
org.drools.rule.ReturnValueConstraint.equals(ReturnValueConstraint.java:121)
at java.util.Arrays.equals(Unknown Source)
at org.drools.rule.OrConstraint.equals(OrConstraint.java:132)
at java.util.AbstractList.equals(Unknown Source)
at org.drools.rule.Pattern.equals(Pattern.java:317)
at org.drools.rule.GroupElement.equals(GroupElement.java:273)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
at
org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
... 11 more
The rule in question is quite straight-forward, works on the initial
load up and worked in 5.0.1 fine. It is not the rule that was just
changed. If I remove that rule, another is just substituted in its
place in the error message.
What might be causing this? If you need more information, please ask.
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
13 years, 6 months
Getting a NamespaceException when building the rule package
by aldrinbondoc
Hi All,
We are trying to build the rule package in Guvnor via HTTP request, since
compilation is not readily available via RestAPI, we developed a custom web
service that will handle our request and trigger invoke a drools api that
would compile the rule package.
The problem is when we tried to invoke the compilation via HTTP request we
are encountering this exception:
org.drools.repository.RulesRepositoryException:
javax.jcr.NamespaceException: drools: is not a registered namespace prefix.
Here is what we saw from the log file.
2011-05-10 10:30:06,753 ERROR [STDERR] Caused by:
javax.jcr.NamespaceException: drools: is not a registered namespace prefix.
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.core.NamespaceRegistryImpl.getURI(NamespaceRegistryImpl.java:516)
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.core.LocalNamespaceMappings.getURI(LocalNamespaceMappings.java:166)
2011-05-10 10:30:06,753 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.NameParser.parse(NameParser.java:116)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.ParsingNameResolver.getQName(ParsingNameResolver.java:62)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:144)
2011-05-10 10:30:06,764 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.PathParser.parse(PathParser.java:57)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver.getQPath(ParsingPathResolver.java:60)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver.getQPath(CachingPathResolver.java:77)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver.getQPath(DefaultNamePathResolver.java:69)
2011-05-10 10:30:06,765 ERROR [STDERR] at
org.apache.jackrabbit.core.SessionImpl.getQPath(SessionImpl.java:649)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:209)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2468)
2011-05-10 10:30:06,788 ERROR [STDERR] at
org.drools.repository.migration.MigrateDroolsPackage.needsMigration(MigrateDroolsPackage.java:19)
2011-05-10 10:30:06,796 ERROR [STDERR] at
org.drools.repository.RulesRepository.checkForDataMigration(RulesRepository.java:103)
Has anyone encountered the same exception before? Your response would be
very much appreciated. Thanks!
BTW. We have BRMS 5.0 hosted on Jboss EAP 4.3.0 application server.
--
View this message in context: http://drools.46999.n3.nabble.com/Getting-a-NamespaceException-when-build...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 6 months
guvnor repository export zip corrupted... debugging ideas?
by Permar, Justin
Good afternoon,
We have an interesting issue that's recently popped up in our Drools Guvnor 5.1.0 war deployment. When we use the Guvnor webapp to download the repository as a zip export (or, alternatively, GET /org.drools.guvnor.Guvnor/backup), the download completes, but the zip file is corrupted (i.e., cannot be opened with 7-Zip). Taking a look at the code (https://github.com/droolsjbpm/guvnor/blob/master/guvnor-webapp/src/main/j... ), I can't see any obvious problem. The only thought that came to mind is that the the servlet never performs an res.getOutputStream().close(), but then again, this servlet has worked fine for us in other deployments. Moreover, no errors are either displayed to the user (I noticed that the "doGet" method returns any exceptions over the OutputStream) or logged to file.
Does anyone have a suggestion on how to continue debugging this problem?
Thanks in advance.
Justin
This e-mail message, including any attachments, is for the
sole use of the intended recipient(s) and may contain
private, confidential and/or privileged information. Any
unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient,
employee or agent responsible for delivering this message,
please contact the sender by reply e-mail and destroy all
copies of the original e-mail message.
13 years, 6 months