[rules-users] Drools 6 Spring JTA Persistence

Alexander Herwix alex at herwix.com
Wed Sep 4 14:50:11 EDT 2013


Hey Markus, 

that sounds really interesting! I would love to know your opinion on how to integrate grails and drools in the best way. If we have similar ideas and goals for the plugin that would be really good way to proceed. Maybe we can set up a talk in irc or the like? I'm currently working on this full time so just hit me up on my mail address to set something up.

Cheers, Alex

Am 04.09.2013 um 19:44 schrieb Markus Schneider <markus.schneider73 at gmail.com>:

> Hi Alex,
> 
> I'm developing a Grails Drools Plugin, too. At the moment I'm working on an ECA (Event Correlation & Analysis) solution so my current focus is on expert & fusion. But jBPM is also an important module that I'll need in the future.
> Maybe we can come togehter and create one feature rich grails plugin.
> Let me know if you're interested.
> 
> Cheers
> 
> -markus
> 
> 
> 
> 
> 
> 2013/9/4 Alexander Herwix <alex at herwix.com>
> Hey Martin,
> 
> haven't looked at your code yet, but I have Drools 6 CR1 and 2 running in grails though without local HT and JTA persistence. It was pretty straight forward, just included the dependencies and pruned duplicate entries (check the dependency report).
> 
> If I get the plugin working I would be glad to share a demo project. However, I think that a fully fledged release of the plugin to grails central would take some more time.
> 
> Cheers, Alex
> 
> Am 03.09.2013 um 21:23 schrieb Martin Minka <martin.minka at gmail.com>:
> 
>> Alex,
>> I am sorry, I don't have solution for your problem, but maybe I will work soon on same issue. 
>> Are you using Drools 6.0.0.CR2 ? If yes, where you able to overcome this problem http://drools.46999.n3.nabble.com/rules-users-classloader-problem-in-Drools-6-0-0-CR1-and-CR2-working-in-Beta5-td4025726.html ?
>> 
>> Do you mind to share your plugin code with community ?
>> 
>> Best regards,
>> Martin
>> 
>> 
>> 
>> 2013/9/3 Alexander Herwix <alex at herwix.com>
>> Hey guys, 
>> 
>> I'm working on a Grails plugin for Drools/Jbpm 6 and I have trouble to get persistence working in a user friendly way. It would be awesome if someone with a better understanding of drools and especially drools spring integration could help me to figure this out :) 
>> 
>> I have considered multiple approaches:
>> 
>> - Use a spring LocalContainerEntityManagerFactoryBean with a local JpaTransactionManager to configure a KieEnvironment via Spring.
>> 
>> I basically got this working, but this doesn't provide real integration with Grails, as there are 2 seperate local TransactionManagers involved - limiting the ability to integrate drools in the grails app.
>> 
>> - Use JTA-Transactions. 
>> 
>> As I want the plugin to be as user friendly as possible I would like to keep using the default tomcat container for development. There is the Atomikos Plugin for Grails which configures Grails to work with JTA. This works pretty nicely and should suffice for the development environment. 
>> 
>> My problem is integrating the Atomikos backed JTATransactionManager with the drools 6 spring environment configuration as I have not much experience with JTA. I have looked at the Tests for Kie-Spring and looked at as much documentation as I could find, but I can't seem to figure this out. 
>> 
>> This is what I use to configure the environment via spring (in Grails groovy syntax)
>> 
>> jbpmGlobals(MapGlobalResolver)
>> 
>>     dacceptor(ClassObjectMarshallingStrategyAcceptor,['*.*'])
>> 
>>     kie.kstore(id:'kiestore')
>> 
>>     kie.environment(id: 'jbpmEnv'){
>>         kie.'entity-manager-factory'(ref:'entityManagerFactory')
>> 
>>         kie.globals(ref:'jbpmGlobals')
>> 
>>         kie.'object-marshalling-strategies'(){
>>             kie.'jpa-placeholder-resolver-strategy'()
>>             kie.'serializable-placeholder-resolver-strategy'('strategy-acceptor-ref':"dacceptor")
>>         }
>>     }
>> //Tried to wrap my JtaTransactionManager with KieSpringTransactionManager
>> jbpmTransactionManager(KieSpringTransactionManager, ref('transactionManager'))
>> 
>> the environment value for transactionManager cannot be set here, because the parser expects a JpaTransactionManager. I tried to add the transactionManager manually to the environment and found the KieSpringTransactionManager, which looked like it could help me somehow, but in the end, there is always the default implementation of the JtaTransactionManager used which can't find the transactionManager that I configured. 
>> 
>> Error:
>> NamingException occurred when processing request: [GET] /bpm/test/testJbpm
>> Cannot create resource instance. Stacktrace follows:
>> javax.naming.NamingException: Cannot create resource instance
>> 	at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:116)
>> 	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
>> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
>> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
>> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
>> 	at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
>> 	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
>> 	at javax.naming.InitialContext.lookup(InitialContext.java:411)
>> 	at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:122)
>> 	at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:69)
>> 	at org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:325)
>> 	at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:114)
>> 	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
>> 	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:67)
>> 	at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:36)
>> 	at bpm.TestController.testJbpm(TestController.groovy:119)
>> 	at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
>> 	at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
>> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> 	at java.lang.Thread.run(Thread.java:722)
>> 
>> 
>> I would be glad about any input. 
>> 
>> Cheers, Alex
>> 
>> 
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130904/a0f32309/attachment.html 


More information about the rules-users mailing list