Re: [rules-users] Exception using persistence
Robert, what's your application server, or your transaction manager? I successfully tested with bitronix in my J2SE application, and with the jboss application server transaction manager. I don't have any further idea for your problem, but, from my own point of view, it's not so dirty to bind it to java:comp/UserTransaction, and is probably your only way to do things without patching the code (as you seem to have seen in the source code java:comp/UserTransaction is not in a variable so... -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoyé : lundi 7 juin 2010 20:50 À : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence For additional information: JPAKnowledgeService.newStatefulKnowledgeSession uses org.drools.persistence.session.SingleSessionCommandService where java:comp/UserTransaction is used (I checked the drools source code). Looks like there is no way to change this. I just wonder that I am the only one having this problem. As I said comp/UserTransaction works, but java:comp/UserTransaction doesn't, but in the docs java:comp/UserTransaction is used !?!?!? Cheers, Rob. Am 07.06.2010, 16:22 Uhr, schrieb PAYET, Manuel manuel.pa...@capgemini.com: It's probably that your transaction manager, for an odd reason, doesn't bind with the good name; You can do the following workaround: Final InitialContext initContext = new InitialContext(); initContext.bind(java:comp/UserTransaction,initContext.lookup(comp/ UserTransaction)); And voila, those two jndi name should point to the same object. I stress the fact that what I've written hasn't been tested. -Message d'origine- De : rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] De la part de Robert Envoyé : lundi 7 juin 2010 16:16 À : rules-users@lists.jboss.org; Mark Proctor Objet : Re: [rules-users] Exception using persistence Hi, still struggling with this one (see below), but I did a slide change in the test-code try { val env = new java.util.Hashtable[String, String] env.put(Context.INITIAL_CONTEXT_FACTORY, bitronix.tm.jndi.BitronixInitialContextFactory) val ctx = new InitialContext(env) val ut1 : UserTransaction = (ctx.lookup( java:comp/UserTransaction)).asInstanceOf[UserTransaction] } catch { case ex: Exception = ex.printStackTrace() } (Sorry, code is in Scala, but should not be a problem to read it). Instead of java:comp/UserTransaction (as written in the docs) I wrote comp/UserTransaction and it works. But since this is some test-code and I am able to do the look-up as I want (comp/UserTransaction), as soon as I use JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) I have no influence anymore (its drools-code ;-) and it looks like its using internally java:comp/UserTransaction. Is there any way to change this (setting it) ? Cheers, Rob Am 01.06.2010, 23:54 Uhr, schrieb Robert robert.weissm...@web.de: Well, I tried this but it does not work. Checking additionally the BitronixInitialContextFactory API where it says: - Implementation of InitialContextFactory that allows lookup of transaction manager and registered resources. The easiest way to use this provider is to create a jndi.properties file in your classpath with this content: java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFa c tory Alternatively, you can create a InitialContext object with an environment pointing to this class: Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, bitronix.tm.jndi.BitronixInitialContextFactory); Context ctx = new InitialContext(env); The transaction manager can be looked up at the standard URL java:comp/UserTransaction while resources can be looked up using their unique name as set in ResourceBean.getUniqueName(). - So, I tried the following ( Its in Scala, but shouldn't be a problem to read): try { val env = new java.util.Hashtable[String, String] env.put(Context.INITIAL_CONTEXT_FACTORY, bitronix.tm.jndi.BitronixInitialContextFactory); val ctx = new InitialContext(env); val ut1 : UserTransaction = (ctx.lookup( java:comp/UserTransaction )).asInstanceOf[UserTransaction] } catch { case ex: Exception = ex.printStackTrace() } But still getting the same problem as before at line val ut1 : What I do not get is that the Bitronix API says that the standard URL is java:comp/UserTransaction, but its somehow not found !?!?!? Any ideas ? Cheers, Rob. Am 31.05.2010, 02:54 Uhr, schrieb Mark Proctor mproc...@codehaus.org: On 30/05/2010 20:28, Robert wrote: Hi, I followed the instructions on setting up the persistence in the drools flow doc, but I get the following
Re: [rules-users] Exception using persistence
Ok, let me start from what the drools doc descripes at http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/html_single/index.html#d0e1458 Here is my code val kbuilder: KnowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder kbuilder.add(ResourceFactory.newClassPathResource(processes/process4.rf), ResourceType.DRF); val kbase: KnowledgeBase = kbuilder.newKnowledgeBase val ds : PoolingDataSource = new PoolingDataSource() ds.setUniqueName(jdbc/processInstanceDS) ds.setClassName(org.h2.jdbcx.JdbcDataSource) ds.setMaxPoolSize(3) ds.setAllowLocalTransactions(true) ds.getDriverProperties().put(user, sa) ds.getDriverProperties().put(password, sasa) ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db) ds.init val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); and the persistence.xml: ?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 providerorg.hibernate.ejb.HibernatePersistence/provider jta-data-sourcejdbc/processInstanceDS/jta-data-source classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.variabletypes.VariableInstanceInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.H2Dialect/ property name=hibernate.max_fetch_depth value=3/ property name=hibernate.hbm2ddl.auto value=update/ property name=hibernate.show_sql value=true/ property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup/ /properties /persistence-unit /persistence Thats pretty much whats in the drools doc. But I get 08.06.2010 13:31:52 org.hibernate.cfg.annotations.Version clinit INFO: Hibernate Annotations 3.4.0.GA 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: Hibernate 3.3.0.SP1 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: hibernate.properties not found 08.06.2010 13:31:52 org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : javassist 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: using JDK 1.4 java.sql.Timestamp handling 08.06.2010 13:31:52 org.hibernate.annotations.common.Version clinit INFO: Hibernate Commons Annotations 3.1.0.GA 08.06.2010 13:31:52 org.hibernate.ejb.Version clinit INFO: Hibernate EntityManager 3.4.0.GA 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: org.drools.persistence.session.SessionInfo 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity org.drools.persistence.session.SessionInfo on table SessionInfo 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: org.drools.persistence.processinstance.ProcessInstanceInfo 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity org.drools.persistence.processinstance.ProcessInstanceInfo on table ProcessInstanceInfo 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo on table VariableInstanceInfo 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class: org.drools.persistence.processinstance.WorkItemInfo 08.06.2010 13:31:53 org.hibernate.cfg.annotations.EntityBinder bindTable INFO: Bind entity org.drools.persistence.processinstance.WorkItemInfo on table WorkItemInfo 08.06.2010 13:31:54 org.hibernate.cfg.annotations.CollectionBinder bindOneToManySecondPass INFO: Mapping collection:
Re: [rules-users] Exception using persistence
I've made the same mistake at the beginning: You'd probably want to replace: val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); By: UserTransaction ut = (UserTransaction) new InitialContext().lookup( java:comp/UserTransaction ); ut.begin(); val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); Ut.commit(); (you didn't open a transaction before ;)) -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoyé : mardi 8 juin 2010 13:42 À : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence Ok, let me start from what the drools doc descripes at http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/html_single/index.html#d0e1458 Here is my code val kbuilder: KnowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder kbuilder.add(ResourceFactory.newClassPathResource(processes/process4.rf), ResourceType.DRF); val kbase: KnowledgeBase = kbuilder.newKnowledgeBase val ds : PoolingDataSource = new PoolingDataSource() ds.setUniqueName(jdbc/processInstanceDS) ds.setClassName(org.h2.jdbcx.JdbcDataSource) ds.setMaxPoolSize(3) ds.setAllowLocalTransactions(true) ds.getDriverProperties().put(user, sa) ds.getDriverProperties().put(password, sasa) ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db) ds.init val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); and the persistence.xml: ?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 providerorg.hibernate.ejb.HibernatePersistence/provider jta-data-sourcejdbc/processInstanceDS/jta-data-source classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.variabletypes.VariableInstanceInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property name=hibernate.dialect value=org.hibernate.dialect.H2Dialect/ property name=hibernate.max_fetch_depth value=3/ property name=hibernate.hbm2ddl.auto value=update/ property name=hibernate.show_sql value=true/ property name=hibernate.transaction.manager_lookup_class value=org.hibernate.transaction.BTMTransactionManagerLookup/ /properties /persistence-unit /persistence Thats pretty much whats in the drools doc. But I get 08.06.2010 13:31:52 org.hibernate.cfg.annotations.Version clinit INFO: Hibernate Annotations 3.4.0.GA 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: Hibernate 3.3.0.SP1 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: hibernate.properties not found 08.06.2010 13:31:52 org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : javassist 08.06.2010 13:31:52 org.hibernate.cfg.Environment clinit INFO: using JDK 1.4 java.sql.Timestamp handling 08.06.2010 13:31:52 org.hibernate.annotations.common.Version clinit INFO: Hibernate Commons Annotations 3.1.0.GA 08.06.2010 13:31:52 org.hibernate.ejb.Version clinit INFO: Hibernate EntityManager 3.4.0.GA 08.06.2010 13:31:53 org.hibernate.cfg.AnnotationBinder bindClass INFO: Binding entity from annotated class:
Re: [rules-users] Exception using persistence
I did, but I get the same Exception as before, but on this new line UserTransaction ut = (UserTransaction) new InitialContext().lookup(java:comp/UserTransaction ); 08.06.2010 14:10:58 org.eclipse.jetty.util.log.Slf4jLog info INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog Exception in thread main javax.naming.NameNotFoundException; remaining name 'UserTransaction' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.rob.tests.AnyTest$.test2(AnyTest.scala:38) at com.rob.tests.AnyTest$.main(AnyTest.scala:18) at com.rob.tests.AnyTest.main(AnyTest.scala) I still don't understand where the java:comp/UserTransaction will be accessible/come-from/being-created ... ? Am 08.06.2010, 13:42 Uhr, schrieb PAYET, Manuel manuel.pa...@capgemini.com: I've made the same mistake at the beginning: You'd probably want to replace: val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); By: UserTransaction ut = (UserTransaction) new InitialContext().lookup( java:comp/UserTransaction ); ut.begin(); val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); Ut.commit(); (you didn't open a transaction before ;)) -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoyé : mardi 8 juin 2010 13:42 À : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence Ok, let me start from what the drools doc descripes at http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/html_single/index.html#d0e1458 Here is my code val kbuilder: KnowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder kbuilder.add(ResourceFactory.newClassPathResource(processes/process4.rf), ResourceType.DRF); val kbase: KnowledgeBase = kbuilder.newKnowledgeBase val ds : PoolingDataSource = new PoolingDataSource() ds.setUniqueName(jdbc/processInstanceDS) ds.setClassName(org.h2.jdbcx.JdbcDataSource) ds.setMaxPoolSize(3) ds.setAllowLocalTransactions(true) ds.getDriverProperties().put(user, sa) ds.getDriverProperties().put(password, sasa) ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db) ds.init val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); and the persistence.xml: ?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 providerorg.hibernate.ejb.HibernatePersistence/provider jta-data-sourcejdbc/processInstanceDS/jta-data-source classorg.drools.persistence.session.SessionInfo/class classorg.drools.persistence.processinstance.ProcessInstanceInfo/class classorg.drools.persistence.processinstance.variabletypes.VariableInstanceInfo/class classorg.drools.persistence.processinstance.WorkItemInfo/class properties property
Re: [rules-users] Exception using persistence
From your source code, I guess you used bitronix. You have to make bitronix initialize it, and by this, bind java:comp/UserTransaction to the transaction manager, So, to do this: You should try: bitronix.tm.TransactionManagerServices.getTransactionManager().begin(); (actually, bitronix.tm.TransactionManagerServices.getTransactionManager() should do it) -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoyé : mardi 8 juin 2010 14:23 À : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence I did, but I get the same Exception as before, but on this new line UserTransaction ut = (UserTransaction) new InitialContext().lookup(java:comp/UserTransaction ); 08.06.2010 14:10:58 org.eclipse.jetty.util.log.Slf4jLog info INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog Exception in thread main javax.naming.NameNotFoundException; remaining name 'UserTransaction' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.rob.tests.AnyTest$.test2(AnyTest.scala:38) at com.rob.tests.AnyTest$.main(AnyTest.scala:18) at com.rob.tests.AnyTest.main(AnyTest.scala) I still don't understand where the java:comp/UserTransaction will be accessible/come-from/being-created ... ? Am 08.06.2010, 13:42 Uhr, schrieb PAYET, Manuel manuel.pa...@capgemini.com: I've made the same mistake at the beginning: You'd probably want to replace: val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); By: UserTransaction ut = (UserTransaction) new InitialContext().lookup( java:comp/UserTransaction ); ut.begin(); val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); Ut.commit(); (you didn't open a transaction before ;)) -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoyé : mardi 8 juin 2010 13:42 À : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence Ok, let me start from what the drools doc descripes at http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/h tml_single/index.html#d0e1458 Here is my code val kbuilder: KnowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder kbuilder.add(ResourceFactory.newClassPathResource(processes/process4. rf), ResourceType.DRF); val kbase: KnowledgeBase = kbuilder.newKnowledgeBase val ds : PoolingDataSource = new PoolingDataSource() ds.setUniqueName(jdbc/processInstanceDS) ds.setClassName(org.h2.jdbcx.JdbcDataSource) ds.setMaxPoolSize(3) ds.setAllowLocalTransactions(true) ds.getDriverProperties().put(user, sa) ds.getDriverProperties().put(password, sasa) ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db) ds.init val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); and the persistence.xml: ?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;
[rules-users] FW: how to fire a subset of rules in KB?
Date: Mon, 7 Jun 2010 17:28:12 +0800 From: wenjinchao wenjinchao0...@gmail.com Subject: [rules-users] how to fire a subset of rules in KB? To: rules-users rules-users@lists.jboss.org Message-ID: 201006071728086572...@gmail.com Content-Type: text/plain; charset=us-ascii Hi all, I'm a newbie for drools. And i want to know how to fire a subset of rules in KB, suppose there are three rules named A,B,C, and I want to fire rule A only. by the way, suppose there is a drl file containing rule, and i have set up KB, and call fireAllRules through statefulKnowledgeSession. After that, the rule file is changed, how to load rules dynamicly? Is there any solution? Thanks in advance! best regards. 2010-06-07 Wenjinchao Hi, I'll take a crack at you first question Check out Agenda Filters: http://legacy.drools.codehaus.org/Agenda The example listed is using Rule Names, but you can use the following to look at Meta Attribute values instead: AgendaFilter filter = new AgendaFilter() { @Override public boolean accept(Activation activation) { // Filter out rule Hello World from Sample.drl for execution if (activation.getRule().getMetaAttribute(Purpose).equals(Print Hello World)) { return true; } return false; } }; On your rules, you'll want to add a meta attribute for groups A, B, and C. Here's an example: rule Hello World @Purpose(Print Hello World)--- THIS IS YOUR META-ATTRIBUTE when m : Message( status == Message.HELLO, myMessage : message ) then System.out.println( myMessage ); m.setMessage( Goodbye cruel world ); m.setStatus( Message.GOODBYE ); update( m ); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Multiple Object Referencing problem
://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100608/b5cfc184/attachment-0001.html -- Message: 2 Date: Tue, 8 Jun 2010 13:39:37 +0100 From: alan.gai...@tessella.com Subject: Re: [rules-users] Exception using persistence To: Rules Users List rules-users@lists.jboss.org Message-ID: of191c8e5f.ae0a5a9c-on8025773c.00455dd5-8025773c.00458...@tessella.co.uk Content-Type: text/plain; charset=iso-8859-1 Robert, Try this: create a directory called META-INF in your classpath in that directory, add a file called jndi.properties in that file, add the line: java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory Does that fix things? Alan Robert robert.weissm...@web.de Sent by: rules-users-boun...@lists.jboss.org 08/06/2010 13:22 Please respond to Rules Users List rules-users@lists.jboss.org To Rules Users List rules-users@lists.jboss.org, Mark Proctor mproc...@codehaus.org, PAYET, Manuel manuel.pa...@capgemini.com cc Subject Re: [rules-users] Exception using persistence I did, but I get the same Exception as before, but on this new line UserTransaction ut = (UserTransaction) new InitialContext().lookup(java:comp/UserTransaction ); 08.06.2010 14:10:58 org.eclipse.jetty.util.log.Slf4jLog info INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog Exception in thread main javax.naming.NameNotFoundException; remaining name 'UserTransaction' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.rob.tests.AnyTest$.test2(AnyTest.scala:38) at com.rob.tests.AnyTest$.main(AnyTest.scala:18) at com.rob.tests.AnyTest.main(AnyTest.scala) I still don't understand where the java:comp/UserTransaction will be accessible/come-from/being-created ... ? Am 08.06.2010, 13:42 Uhr, schrieb PAYET, Manuel manuel.pa...@capgemini.com: I've made the same mistake at the beginning: You'd probably want to replace: val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); By: UserTransaction ut = (UserTransaction) new InitialContext().lookup( java:comp/UserTransaction ); ut.begin(); val emf : EntityManagerFactory = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ) val env : Environment = KnowledgeBaseFactory.newEnvironment() env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ) val ksession : StatefulKnowledgeSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ) val sessionId = ksession.getId ksession.startProcess( Process4 ) ksession.dispose(); Ut.commit(); (you didn't open a transaction before ;)) -Message d'origine- De : robert.weissm...@web.de [mailto:robert.weissm...@web.de] Envoy? : mardi 8 juin 2010 13:42 ? : Rules Users List; Mark Proctor; PAYET, Manuel Objet : Re: [rules-users] Exception using persistence Ok, let me start from what the drools doc descripes at http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-flow/html_single/index.html#d0e1458 Here is my code val kbuilder: KnowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder kbuilder.add(ResourceFactory.newClassPathResource(processes/process4.rf), ResourceType.DRF); val kbase: KnowledgeBase = kbuilder.newKnowledgeBase val ds : PoolingDataSource = new PoolingDataSource() ds.setUniqueName(jdbc/processInstanceDS) ds.setClassName(org.h2.jdbcx.JdbcDataSource) ds.setMaxPoolSize(3) ds.setAllowLocalTransactions(true) ds.getDriverProperties().put(user, sa) ds.getDriverProperties().put(password, sasa) ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db) ds.init val emf : EntityManagerFactory
[rules-users] help
) -- Message: 1 Date: Tue, 8 Jun 2010 09:25:47 -0300 From: Esteban Aliverti esteban.alive...@gmail.com Subject: Re: [rules-users] Multiple Object Referencing problem To: Rules Users List rules-users@lists.jboss.org Message-ID: aanlktilcfczwhx6uthwz3tivkjxdtqvkxcb0ug-rq...@mail.gmail.com Content-Type: text/plain; charset=windows-1252 Look at the line 58 of RulesTest class and you will find the problem. Try to always analyse the stacktrace if there are no drools classes involved, then it is not a Drools error. And remember, the debugger is your friend ;) Best, 2010/6/7 David Sinclair dsincl...@chariotsolutions.com This has nothing to do with Drools. It looks like you are giving Writer bad input perhaps?? Exception in thread main *java.lang.NullPointerException* at java.io.Writer.write(Unknown Source) at com.org.RulesTest.main(*RulesTest.java:58*) 2010/6/7 Fnu Mahalakshmi fmahalaks...@nyx.com Hi, I am trying out this example from the book : public class Room { private String name // getter and setter methods here } public classs Sprinkler { private Room room; private boolean on; // getter and setter methods here } public class Fire { private Room room; // getter and setter methods here } I load 2 input files: 1. with data of fire and Room { f1, r1;f2, r2} 2. with data of sprinkler and Room { ? ?, r1; ? ? , r2} I am writing rule ? if fire exists in room start sprinkler? { so if f1 and r1 in this case: I should get s1, r1 } when Fire($room : room) $sprinkler : Sprinkler( room == $room, modified == false ) Then $sprinkler.setmodified(true); modify( $sprinkler ) { setSprinkle( ?s1? ) }; end But this gives me error: Exception in thread main *java.lang.NullPointerException* at java.io.Writer.write(Unknown Source) at com.org.RulesTest.main(*RulesTest.java:58*) From what I observed this rule is not getting fired at all. I want this rule to be fired on the data in my second input file. The rules for my first input file get executed properly. Can any1 tell me where I am going wrong?? Is there any way in which we can use the modified data { after rules are fired on the first input data and it is modified}to fire another set of rules on the same input depending on the next input file??? Thank you. -M -- *Please consider the environment before printing this email.* *Visit our website at http://www.nyse.com * Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti -- next part -- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100608/b5cfc184/attachment-0001.html -- Message: 2 Date: Tue, 8 Jun 2010 13:39:37 +0100 From: alan.gai...@tessella.com Subject: Re: [rules-users] Exception using persistence To: Rules Users List rules-users@lists.jboss.org Message-ID: of191c8e5f.ae0a5a9c-on8025773c.00455dd5-8025773c.00458...@tessella.co.uk Content-Type: text/plain; charset=iso-8859-1 Robert, Try this: create a directory called META-INF in your classpath in that directory, add a file called jndi.properties in that file, add the line: java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory Does that fix things? Alan Robert robert.weissm...@web.de Sent by: rules-users-boun...@lists.jboss.org 08/06/2010 13:22 Please respond to Rules Users List rules-users@lists.jboss.org To Rules Users List rules-users@lists.jboss.org, Mark Proctor mproc...@codehaus.org, PAYET, Manuel manuel.pa...@capgemini.com cc Subject Re: [rules-users] Exception using persistence I did, but I get the same Exception as before, but on this new line UserTransaction ut
Re: [rules-users] Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node
Update::: On the exception(mentioned below) related to jar drools-bpmn2-5.1.0.M2.jar, I recreated this jar file from the Drools source (5.1.0.M2) against JDK6 and the exception went away. :) So far so good. Plugin related exception is still there. I replaced the jar drools-bpmn2.jar which is present in the lib of plugin jar org.drools.eclipse_5.1.0.M2.jar with the recompiled jar, but not much luck - plugin is still not able to open the *.bpmn process. The error I get is The method getTextContent() is undefined for the type Node . Right now I am at a dead end. Thanks in advance for help. Thanks Vijay From: Vijay K Pandey Sent: Monday, June 07, 2010 5:45 PM To: 'Rules Users List' Subject: RE: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node I created a sample project to run a very simple rule flow (BPMN process), I got the similar error which the plugin is reporting. My env is SUN JDK 6. Here is the exception I get? Any clue guys. Exception in thread main java.lang.Error: Unresolved compilation problems: The method getTextContent() is undefined for the type Node The method getTextContent() is undefined for the type Node at org.drools.bpmn2.xml.StartEventHandler.handleNode(StartEventHandler.java:46) at org.drools.bpmn2.xml.AbstractNodeHandler.end(AbstractNodeHandler.java:77) at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:420) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:739) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:295) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:174) at org.drools.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:44) at org.drools.compiler.ProcessBuilder.addProcessFromFile(ProcessBuilder.java:222) at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:415) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:475) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:517) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) Thanks Vijay From: Vijay K Pandey Sent: Sunday, June 06, 2010 11:43 PM To: Rules Users List Subject: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node Hi, I just downloaded the Drools 5.1.0.M2 (have been using the snapshot version of around 16th April 2010) - created a sample rule flow file(start--user task--end) - bpmn2 version. But when I clicked the file to open it gave the following error (image attached) The method getTextContent() is undefined for the type Node . I understand this error is related to org.w3c.dom.Node where this method was added as part of DOM Level 3 and available in JDK 5+ . My project and eclipse is configured against JDK 6+ . Not sure why this error with M2. May be it is because of the drools-bpmn2.jar included in the drools eclipse plugin? Can someone shed some light that where it might be going wrong. [cid:image001.png@01CB06E7.1655B9C0] Thanks Vijay inline: image001.png___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.1.0.M2
Drools 5.1.0.M2 still isn't available from the JBoss Maven repository (at http://repository.jboss.com/maven2/org/drools/). Any idea when it will be made available? Thanks, Alan___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Exception using persistence
I had this in before, I put now Manuels and your last advice back in, now the code looks like (I put it to Java - you never know): public static void main(String[] args) throws SystemException, NotSupportedException, NamingException { BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager(); tm.begin(); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(processes/process4.rf), ResourceType.DRF); KnowledgeBase kbase = kbuilder.newKnowledgeBase(); PoolingDataSource ds = new PoolingDataSource(); ds.setUniqueName(jdbc/processInstanceDS); ds.setClassName(org.h2.jdbcx.JdbcDataSource); ds.setMaxPoolSize(3); ds.setAllowLocalTransactions(true); ds.getDriverProperties().put(user, sa); ds.getDriverProperties().put(password, sasa); ds.getDriverProperties().put(URL, jdbc:h2:file:/NotBackedUp/data/process-instance-db); ds.init(); UserTransaction ut = (UserTransaction)(new InitialContext()).lookup( java:comp/UserTransaction ); ut.begin(); // create the entity manager factory and register it in the environment EntityManagerFactory emf = Persistence.createEntityManagerFactory( org.drools.persistence.jpa ); Environment env = KnowledgeBaseFactory.newEnvironment(); env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); // create a new knowledge session that uses JPA to store the runtime state StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env ); int sessionId = ksession.getId(); // invoke methods on your method here ksession.startProcess( Process4 ); ksession.dispose(); } I extended BitronixInitialContextFactory to public class ExtendedBitronixInitialContextFactory extends BitronixInitialContextFactory { public ExtendedBitronixInitialContextFactory() { super(); } } so I can set easily a breakpoint in the constructor to make sure this will be called and put that into the jndi.properties (java.naming.factory.initial=com.rob.tests.ExtendedBitronixInitialContextFactory). But I still get the same exception: 08.06.2010 15:35:19 bitronix.tm.BitronixTransactionManager logVersion INFO: Bitronix Transaction Manager version 1.3.2 08.06.2010 15:35:20 bitronix.tm.Configuration buildServerIdArray WARNUNG: 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!). 08.06.2010 15:35:20 bitronix.tm.Configuration buildServerIdArray INFO: JVM unique ID: 192.168.254.2 08.06.2010 15:35:20 bitronix.tm.journal.DiskJournal open WARNUNG: active log file is unclean, previous server crash ? 08.06.2010 15:35:20 bitronix.tm.recovery.Recoverer run INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 0 resource(s) [] 08.06.2010 15:35:46 bitronix.tm.recovery.IncrementalRecoverer recover INFO: incremental recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on resource [jdbc/processInstanceDS] 08.06.2010 15:35:52 org.eclipse.jetty.util.log.Slf4jLog info INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog Exception in thread main javax.naming.NameNotFoundException; remaining name 'UserTransaction' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:576) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:663) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:678) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:110) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.rob.tests.AnyTest2.main(AnyTest2.java:50) The ExtendedBitronixInitialContextFactory will be instantiated (at least the debugger stops at the super();) just when the line UserTransaction ut = (UserTransaction)(new InitialContext()).lookup( java:comp/UserTransaction ); is/was ? called (maybe somehow too late ?). What am I doing wrong ? Am 08.06.2010, 14:39 Uhr, schrieb alan.gai...@tessella.com: Robert, Try this: create a directory called META-INF in your classpath in that directory, add a file called jndi.properties in that file, add the line: java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory Does that fix things? Alan Robert robert.weissm...@web.de Sent by: rules-users-boun...@lists.jboss.org 08/06/2010 13:22 Please respond to Rules Users List rules-users@lists.jboss.org To Rules Users List rules-users@lists.jboss.org, Mark Proctor mproc...@codehaus.org, PAYET, Manuel manuel.pa...@capgemini.com cc
Re: [rules-users] Multiple Object referencing error
Hi, Sorry about not posting the code. My mistake. Classes : public class Room { private String name private int number; // getter and setter methods here } public classs Sprinkler { private Room room; private boolean on; // getter and setter methods here } public class Fire { private Room room; // getter and setter methods here } I load 2 input files: 1. with data of fire and Room { f1, r1;f2, r2} 2. with data of sprinkler and Room {n/a,r1,n/a,r3} I am writing rule if fire exists in room start sprinkler { so if f1 and r1 in this case: I should get s1, r1 } But since no sprinkler in r2 , That data should not get outputted. I want my ouput file to look like: NameNumber Xyz 1 # xyz is my room name and 1 is the room number : r1(xyz,1) . But I am unable to delete entries.Is there anyway I can do it? #only this should appears as the other room does not have a sprinkler. when Fire($room : room) $sprinkler : Sprinkler( room == $room, modified == false ) Then $sprinkler.setmodified(true); modify( $sprinkler ) { setSprinkle( s1 ) }; end Error: I am getting the error at a place where I am trying to write back from my working memory to my output file. It is happening because the second rule to turn on the sprinkler does not work and as a result a null value is getting stored. Is it possible that there can exists 2 different Room() objects with the same room.name ?? Because the room objects are getting stored from different files to the working memory ?? Do you think it better to store room objects in a separate list?? I store all information into a list and load that into the memory. Am I going wrong here? Please help. Thank you. -M Please consider the environment before printing this email. Visit our website at http://www.nyse.com Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] smooks query
Hi, Can anyone point me towards a good documentation as to how smooks works with drools? How does smooks transform non-XML(java) data?? I could not understand this part??? Thank you in advance, M /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node
Update::: Issues related to Plugin. When I recompiled the bpmn2 src and put that jar in the plugin lib, it simply didn't took the recompiled version. Then I removed the jar from the plugin lib and simply copied the - bpmn2 classes directly in the org/drools package of the plugin and voila - plugin started working fine. Thanks Vijay From: Vijay K Pandey Sent: Tuesday, June 08, 2010 8:48 AM To: 'Rules Users List' Subject: RE: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node Update::: On the exception(mentioned below) related to jar drools-bpmn2-5.1.0.M2.jar, I recreated this jar file from the Drools source (5.1.0.M2) against JDK6 and the exception went away. :) So far so good. Plugin related exception is still there. I replaced the jar drools-bpmn2.jar which is present in the lib of plugin jar org.drools.eclipse_5.1.0.M2.jar with the recompiled jar, but not much luck - plugin is still not able to open the *.bpmn process. The error I get is The method getTextContent() is undefined for the type Node . Right now I am at a dead end. Thanks in advance for help. Thanks Vijay From: Vijay K Pandey Sent: Monday, June 07, 2010 5:45 PM To: 'Rules Users List' Subject: RE: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node I created a sample project to run a very simple rule flow (BPMN process), I got the similar error which the plugin is reporting. My env is SUN JDK 6. Here is the exception I get? Any clue guys. Exception in thread main java.lang.Error: Unresolved compilation problems: The method getTextContent() is undefined for the type Node The method getTextContent() is undefined for the type Node at org.drools.bpmn2.xml.StartEventHandler.handleNode(StartEventHandler.java:46) at org.drools.bpmn2.xml.AbstractNodeHandler.end(AbstractNodeHandler.java:77) at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:420) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:739) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:295) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:174) at org.drools.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:44) at org.drools.compiler.ProcessBuilder.addProcessFromFile(ProcessBuilder.java:222) at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:415) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:475) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:517) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) Thanks Vijay From: Vijay K Pandey Sent: Sunday, June 06, 2010 11:43 PM To: Rules Users List Subject: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node Hi, I just downloaded the Drools 5.1.0.M2 (have been using the snapshot version of around 16th April 2010) - created a sample rule flow file(start--user task--end) - bpmn2 version. But when I clicked the file to open it gave the following error (image attached) The method getTextContent() is undefined for the type Node . I understand this error is related to org.w3c.dom.Node where this method was added as part of DOM Level 3 and available in JDK 5+ . My project
[rules-users] Flow exception handling
Hi Everyone, I'm trying to get my head round how to use Drools Flow in a reliable manner. In particular I'm trying to understand how to defensively program against exceptions thrown within Action Nodes (eg NullPointerException). In 5.0.1 it is absolutely horrendous as if the action throws an exception while being called from fireUntilHalt then the exception just gets swallowed up with no way for the application to detect it at all. In 5.1.0-M1 it is marginally better in that the exception is thrown through fireUntilHalt (or whatever other location it is called from). However there seems to be absolutely no way to determine which process is at fault - the process isn't even marked as Aborted and still exists in the session, also if you call fireUntilHalt again it just seems to sit there and not run any more processes. It doesn't even throw an IllegalState type exception to tell you it isn't valid to call it after an exception has occurred. What I was expecting was that processes work in a similar way to java threads. If a particular process encounters an exception I would expect that: 1. The process is marked as aborted. 2. An appropriate method on a process event listener is called. 3. Any other processes in the session will attempt to continue to run. Clearly depending on your session configuration the working memory may be in an invalid state and other processes may be stuck waiting for an event to occur which never will, but this is a design decision for the application developer, in many other cases processes will be stand alone keeping all their data internal to themselves. Is there some other functionality of Drools that I am missing or should I raise a JIRA for this (if one doesn't already exist). Thomas ** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmas...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ** ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.1.0.M2
JBoss recently updated their maven repository. Unfortunately I don't think that the old repository (the one you listed) is going to continue getting new updates. The new repo url is https://repository.jboss.org/nexus/content/groups/public/ You can see the 5.1.0.M2 artifact is available at that URL: https://repository.jboss.org/nexus/content/groups/public/org/drools/drools/5.1.0.M2/ You can read more about the new repo on their wiki: http://community.jboss.org/wiki/MavenGettingStarted-Users Thanks, Steve rules-users-boun...@lists.jboss.org wrote on 06/08/2010 08:52:39 AM: From: alan.gai...@tessella.com To: Rules Users List rules-users@lists.jboss.org Date: 06/08/2010 08:57 AM Subject: [rules-users] Drools 5.1.0.M2 Sent by: rules-users-boun...@lists.jboss.org Drools 5.1.0.M2 still isn't available from the JBoss Maven repository (at http://repository.jboss.com/maven2/org/drools/). Any idea when it will be made available? Thanks, Alan___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Multiple Object Referencing error
-- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100608/1e644b0f/attachment-0001.html -- Message: 4 Date: Tue, 08 Jun 2010 10:36:58 -0500 From: Vijay K Pandey vpan...@mdes.ms.gov Subject: Re: [rules-users] Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node To: Rules Users List rules-users@lists.jboss.org Message-ID: 412f68bc577b1444952eecc341cde93b02051af...@hqsombx001.mdesad.mdesnet.ms.gov Content-Type: text/plain; charset=iso-8859-1 Update::: Issues related to Plugin. When I recompiled the bpmn2 src and put that jar in the plugin lib, it simply didn't took the recompiled version. Then I removed the jar from the plugin lib and simply copied the - bpmn2 classes directly in the org/drools package of the plugin and voila - plugin started working fine. Thanks Vijay From: Vijay K Pandey Sent: Tuesday, June 08, 2010 8:48 AM To: 'Rules Users List' Subject: RE: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node Update::: On the exception(mentioned below) related to jar drools-bpmn2-5.1.0.M2.jar, I recreated this jar file from the Drools source (5.1.0.M2) against JDK6 and the exception went away. :) So far so good. Plugin related exception is still there. I replaced the jar drools-bpmn2.jar which is present in the lib of plugin jar org.drools.eclipse_5.1.0.M2.jar with the recompiled jar, but not much luck - plugin is still not able to open the *.bpmn process. The error I get is The method getTextContent() is undefined for the type Node . Right now I am at a dead end. Thanks in advance for help. Thanks Vijay From: Vijay K Pandey Sent: Monday, June 07, 2010 5:45 PM To: 'Rules Users List' Subject: RE: Drools 5.1.0.M2 - BPMN2 process issue - Eclipse plugin. -- The method getTextContent() is undefined for the type Node I created a sample project to run a very simple rule flow (BPMN process), I got the similar error which the plugin is reporting. My env is SUN JDK 6. Here is the exception I get? Any clue guys. Exception in thread main java.lang.Error: Unresolved compilation problems: The method getTextContent() is undefined for the type Node The method getTextContent() is undefined for the type Node at org.drools.bpmn2.xml.StartEventHandler.handleNode(StartEventHandler.java:46) at org.drools.bpmn2.xml.AbstractNodeHandler.end(AbstractNodeHandler.java:77) at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:420) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:739) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:295) at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:174) at org.drools.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:44) at org.drools.compiler.ProcessBuilder.addProcessFromFile(ProcessBuilder.java:222) at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:415) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:475) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:517) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) Thanks Vijay From: Vijay K Pandey Sent: Sunday, June 06, 2010 11:43 PM To: Rules Users
[rules-users] Multiple Files Problem
Hi, I need to load data contained in many Lists as my input. In what way is it possible for me to load multiple lists in drools? I am doing this currently: public void runStatelessRules(String[] rulesFiles,String dslFileName,CollectionObjectal, String ruleFlowFileName) throws Exception { RuleBase ruleBase = loadRules(rulesFiles); StatelessSession workingMemory = ruleBase.newStatelessSession(); workingMemory.execute(al); } CollectionObjectal is my input. In this I have dumped data from multiple arrayLists. All rules get processed accurately. But creates a mess when I need to write to my output file. Is it in some way possible for me to give separate lists to load to my working memory??? Please help. Thanks in advance. -M /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] error getting values from working memory
Hi, I am facing problem in getting modified data from my working memory to my output file. I have added all my data to an ArrayList. Sent it to my Rules - modified the input. Now I want it to display the data contained in the objects of my list. Unable to do that as I can only map it to ArrayListObject So I am not able to call the particular functions for displaying particular data. I tried adding my data to a HashMapObject,String but then data does not get loaded in the working memory. Please help!!! Thank you M /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] error getting values from working memory
Hi, Please disregard my previous question. It was a stupid bug in my code. Thank you M /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] data manipulation
Hi all, We recently implemented Drools in a mortgage application process. The primary task of the business rule engine was to determine the fraud risk of an application. The application is delivered in XML format. We noticed that we were implementing a lot of data manipulation actions in the drl file itself. For example, the calculation of total income by calculating the sum of a number of elements or calculating the distance between two geo-locations based on zip codes. The actual evaluation rules acted on this 'derived' information. When looking back the drl file contained a lot of code and looked pretty complicated compared to the actual evaluation rules. My question is, what is your opinion on data manipulation or transformation within the drl file? If the drl file is not the best place for this, what would you suggest for data manipulation? Thanks, Betto ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] data manipulation
For data manipulation you can use something like apache camel. To transform the information and then make inferences over it. Greetings - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Mauricio Salaboy Salatino - On Jun 8, 2010, at 15:45, Betto Bardi betto.ba...@yahoo.com wrote: Hi all, We recently implemented Drools in a mortgage application process. The primary task of the business rule engine was to determine the fraud risk of an application. The application is delivered in XML format. We noticed that we were implementing a lot of data manipulation actions in the drl file itself. For example, the calculation of total income by calculating the sum of a number of elements or calculating the distance between two geo-locations based on zip codes. The actual evaluation rules acted on this 'derived' information. When looking back the drl file contained a lot of code and looked pretty complicated compared to the actual evaluation rules. My question is, what is your opinion on data manipulation or transformation within the drl file? If the drl file is not the best place for this, what would you suggest for data manipulation? Thanks, Betto ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] data manipulation
You may also want to look into a JAXB type binding implementation, or something simpler like XMLBeans at Apache (http://xmlbeans.apache.org/). You would then be able to simple push those populated objects (based on the Mortgage's XML schema) directly into working memory and only write rules to process plain beans. Mauricio's suggestion is also really good. :) best wishes, Andrew On Jun 8, 2010, at 5:25 PM, Salaboy wrote: For data manipulation you can use something like apache camel. To transform the information and then make inferences over it. Greetings - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Mauricio Salaboy Salatino - On Jun 8, 2010, at 15:45, Betto Bardi betto.ba...@yahoo.com wrote: Hi all, We recently implemented Drools in a mortgage application process. The primary task of the business rule engine was to determine the fraud risk of an application. The application is delivered in XML format. We noticed that we were implementing a lot of data manipulation actions in the drl file itself. For example, the calculation of total income by calculating the sum of a number of elements or calculating the distance between two geo-locations based on zip codes. The actual evaluation rules acted on this 'derived' information. When looking back the drl file contained a lot of code and looked pretty complicated compared to the actual evaluation rules. My question is, what is your opinion on data manipulation or transformation within the drl file? If the drl file is not the best place for this, what would you suggest for data manipulation? Thanks, Betto ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] alerts in drools
Hi, Is there anyway I can create alerts in drools?? If there is any documentation for it could someone point me towards it?? Thank you -m /pre Phr size=1/P PSTRONGfont color=greenPlease consider the environment before printing this email./font/STRONG/P PSTRONGVisit our website at a href=http://www.nyse.com;http://www.nyse.com/a br * br Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. /STRONG/Ppre ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] alerts in drools
Why do you need alerts for? If you are trying to see somehow the execution of a group of rules, you can attach an AgendaEventListener to your session: ksession.addEventListener( new AgendaEventListener(){ } ); Best, 2010/6/8 Fnu Mahalakshmi fmahalaks...@nyx.com Hi, Is there anyway I can create “alerts” in drools?? If there is any documentation for it could someone point me towards it?? Thank you -m -- *Please consider the environment before printing this email.* *Visit our website at http://www.nyse.com * Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users