Rule Templates and Array Handling
by Jason Allen
Hi All,
I'm trying to determine if it's possible to process arrays of data using Rule Templates. An example of what I'm trying to accomplish.
Spreadsheet of rules, with one of the columns being valid colors. Valid colors contains comma separated data and is variable length.
For example
It might contain: "Blue, Green, Red" or "Blue", or "Red, Green, Purple, Silver" Any number of entries.
I then need to process incoming fact values against this list of colors, using either CONTAINS or IN.
For example:
template header
desc
valid_colors[]
package org.drools.examples.templates
global com.sample.Product product;
template "ColorTestTemplate"
rule "ColorRule_(a){row.rowNumber}"
when
product1 : Product (Color in @{valid_colors});
then
product1.setDesc("@{desc}");
end
end template
I know the following doesn't work: product1 : Product (Color in @{valid_colors});
However, I wanted to depict what I'm trying to accomplish.
The challenge is with valid_colors being a variable length array, I can't refer to the individual values using constants i.e. valid_colors0, valid_colors1, valid_colors3, etc to build my array list.
ie Color in ("@{valid_colors0}", "@{valid_colors1}", "@{valid_colors2}")
Is there a way to iterate through a variable length array in a template?
Any thoughts on how I could build an array list i.e. ("Blue", "Green", "Red") when the column contains a variable length array?
Thanks in advance,
Jason
11 years, 6 months
Guvnor 6.0.0.Beta2 on Tomcat 7 - should problems be reported?
by kappert
I have deployed guvnor-6.0.0.Beta2-tomcat7.0.war on Tomcat 7 in Jelastic (a
cloud provider).
The guided rule editor does not come up and this is an exception I have
found in catalina.out:
org.jboss.errai.marshalling.client.api.exceptions.MarshallingException:
class is not available to the marshaller framework:
org.jboss.errai.bus.server.QueueUnavailableException
at
org.jboss.errai.marshalling.server.MappingContextSingleton$4.getMarshaller(MappingContextSingleton.java:292)
at
org.jboss.errai.marshalling.client.api.AbstractMarshallingSession.getMarshallerInstance(AbstractMarshallingSession.java:67)
at
org.jboss.errai.marshalling.client.util.MarshallUtil.getMarshaller(MarshallUtil.java:125)
...
Has the time already come to discuss such problems? Is this the right place
to do so?
And, of course , does anybody have an idea how to fix this specific problem?
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-6-0-0-Beta2-on-Tomcat-7-should-p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 6 months
Exception jitting
by Bojan Janisch
Hello everyone,
recently I'm using Drools in a multi-threaded environment.
Since then I get sometimes RuntimeExceptions like this:
Exception in thread "Thread-10" java.lang.RuntimeException: Exception jitting: getConcept().identifierSource.toLowerCase.contains("anatomy")
at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
at org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41)
at org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: [Lorg/drools/rule/Declaration;
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2416)
at java.lang.Class.getConstructor0(Class.java:2726)
at java.lang.Class.getConstructor(Class.java:1676)
at org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
at org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
at org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.drools.rule.Declaration
at java.lang.ClassLoader.findClass(ClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 12 more
The rule which produces the exception, is always another and there's also always another cause (so getConcept()... works fine). I've got the error message
with this rule:
import function rulevolution.utils.FactChecker.*;
import function rulevolution.utils.ODMAnswerManager.*;
global org.apache.uima.util.impl.JSR47Logger_impl log
global org.apache.uima.jcas.JCas aJCas
rule '129'
when
$0:NormalizedNamedEntity(
ct_0:CoveredText,
cp_0:Concept,
label_0:getConcept().getPrefLabel().value,
getConcept().identifierSource.toLowerCase.contains("bodyside"))
not $1:NormalizedNamedEntity(
ct_1:CoveredText,
cp_1:Concept,
label_1:getConcept().getPrefLabel().value,
getConcept().identifierSource.toLowerCase.contains("anatomy"))
$2:NormalizedNamedEntity(
ct_2:CoveredText,
cp_2:Concept,
label_2:getConcept().getPrefLabel().value,
endsWith($0,$2))
not $3:NormalizedNamedEntity(
ct_3:CoveredText,
cp_3:Concept,
label_3:getConcept().getPrefLabel().value,
endsWith($0,$2))
not $4:NormalizedNamedEntity(
ct_4:CoveredText,
cp_4:Concept,
label_4:getConcept().getPrefLabel().value,
endsWith($2,$0))
$5:NormalizedNamedEntity(
ct_5:CoveredText,
cp_5:Concept,
label_5:getConcept().getPrefLabel().value,
endsWith($0,$2))
not $6:NormalizedNamedEntity(
ct_6:CoveredText,
cp_6:Concept,
label_6:getConcept().getPrefLabel().value,
isBetween($6,$0,$5))
not $7:NormalizedNamedEntity(
ct_7:CoveredText,
cp_7:Concept,
label_7:getConcept().getPrefLabel().value,
getConcept().identifierSource.toLowerCase.contains("anatomy"))
$8:NormalizedNamedEntity(
ct_8:CoveredText,
cp_8:Concept,
label_8:getConcept().getPrefLabel().value,
endsWith($8,$0))
then
int start = getStart($0,$2,$5,$8);
int ende = getStop($0,$2,$5,$8);
String attribute = label_0+" "+label_2+" "+label_5+" "+label_8;
insert(annotate(aJCas, "de.cloud4health.odm.eprd.itemGroup.operation", 0, attribute, start, ende, "", attribute));
end
Like you see it is a huge rule, but it's created automatically with genetic evolution so I haven't written it actually.
If I use this rule in a single threaded environment, everything runs fine, so could there be a multi-threading problem
with Drools itself?
Greetings
Bojan
11 years, 6 months
Guvnor: Accessing Bound Variable in "Then" Statement
by Vann_the_Red
Hello. I started with a search and didn't find an answer. I apologize if my
search-fu was lacking today.
I'm a non-developer tasked with rules creation and testing using guvnor. I
have found some scenarios where I can bind a variable to either the whole
input model or a fact in the input model and then later access those in the
output model by selecting "Bound Variable" from the popup box in the Then
statement. In other scenarios, "Bound Variable" is not an option (only
Literal or Formula). What must I do to be able to access the bound
variables from the When statement(s) in the Then statement(s)?
TIA,
Vann
This is a repost because I wasn't on the mailing list yet and I gather most
didn't see it. Apologies again.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Accessing-Bound-Variable-in-Then...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 6 months
fact updates with query-only usage of Drools
by Andras Nagy
Dear All,
In a multithreaded application I plan to use Drools the following way:
-use only queries but not rules
-keep an outside reference to all facts inserted into the working memory,
and keep modifying the facts after they were inserted
-use locks synchronizing outside fact changes and Drools query executions
(happening parallelly on other threads), to make sure that when the queries
are executed, the facts are always in a consistent state
Given that the application only uses queries (and no rules), I wonder if
there is a need to notify the engine of the fact changes (e.g.
workingMemory.update(...) etc.).
Could someone confirm that?
Thank you,
Andras
11 years, 6 months
Re: [rules-users] IllegalStateException when disposing of a persisted session
by Thomas Grayson
For whoever is interested, I determined why StatefulKnowledgeSession.dispose threw an IllegalStateException for a persisted session. The error message refers to the thread, which led me to discover that the dispose would work if it was executed on the same thread where it had been created. The org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource method at the top of the stack trace attempts to look up the resource in ThreadLocal storage. My shutdown hook was running on a different thread, so this lookup was failing.
I used the standard Java wait/notify mechanism to fix this. I now suspend my main thread after it creates the knowledge session with Object.wait. When the shutdown hook thread runs, it calls Object.notifyAll to release the main thread, which then disposes of the session successfully. The rest of my application runs in other threads, so suspending the main thread causes no harm.
I still would appreciate some clarification of how the "Configuring JTA DataSource" code<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/...> in the documentation is meant to be used.
Thanks,
Tom
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Thomas Grayson
Sent: Wednesday, June 12, 2013 3:42 PM
To: Rules Users List
Subject: [rules-users] IllegalStateException when disposing of a persisted session
We are using Drools persistence with a StatefulKnowledgeSession. The persistence itself works fine, but I am encountering an IllegalStateException when disposing of the StatefulKnowledgeSession. This happens with either a brand new session with no facts or one that has had facts added to it. It also happens with sessions that have been restored from the persistent store. The code does no explicit transaction management and relies on Drools to do this under the covers. We are using Drools 5.5.0 Final. How do I dispose of a session correctly?
The documentation<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/...> includes Example 3.66, "Configuring JTA DataSource." My code does not include code like this anywhere. Do I need it? It's not clear from the example where the PoolingDataSource instance would be used or when this code should be called. If this configuration is required, can it be done via Spring instead of programmatically?
I'll provide some supporting information below. I've edited these excerpts to redact some private details and eliminate distracting code, but the substance is intact.
Here is the stack trace created by invoking the "dispose" method from a shutdown hook:
java.lang.IllegalStateException: No value for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@732e3e73] bound to thread [Thread-3]
at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209)
at org.drools.container.spring.beans.persistence.DroolsSpringJpaManager.dispose(DroolsSpringJpaManager.java:135)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:345)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.dispose(CommandBasedStatefulKnowledgeSession.java:241)
at MyClass1.stop
at MyClass2$1.run
at java.lang.Thread.run(Unknown Source)
The code uses Drools-Spring to configure the knowledge base and Java code to initialize the knowledge session. We're using JPA, the Bitronix transaction manager, and the H2 database, basically as described in the documentation<http://docs.jboss.org/drools/release/5.5.0.Final/droolsjbpm-introduction-...>. Here is the code for creating the session:
ApplicationContext context = new ClassPathXmlApplicationContext(APPLICATION_CONTEXT_XML);
KnowledgeStoreService kstore = (KnowledgeStoreService) context.getBean("myAppKnowledgeStore");
KnowledgeBase kbase = ...; // initialized by Spring configuration
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, context.getBean("entityManagerFactory"));
env.set(EnvironmentName.TRANSACTION_MANAGER, context.getBean("txManager"));
StatefulKnowledgeSession ksession = kstore.newStatefulKnowledgeSession(kbase, null, env);
Here is the relevant portion of the Spring ApplicationContext.xml file:
<bean id="dataSourceH2"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost/~/myApp" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSourceH2" />
<property name="persistenceUnitName" value="myAppH2" />
</bean>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<drools:grid-node id="myAppEngineNode" />
<drools:kstore id="myAppKnowledgeStore" />
<drools:kbase id="myAppEngineKBase" node="MyAppEngineNode">
<drools:configuration>
<drools:assert-behavior mode="EQUALITY" />
</drools:configuration>
<drools:resources>
<drools:resource type="DRL" source="classpath:MyAppInternalRules.drl" />
<drools:resource type="DTABLE" source="classpath:MyAppRules.xls" >
<drools:decisiontable-conf input-type="XLS" worksheet-name="Sheet 1" />
</drools:resource>
<drools:resource type="DTABLE" source="classpath:MyAppRules.xls" >
<drools:decisiontable-conf input-type="XLS" worksheet-name="Sheet 2" />
</drools:resource>
</drools:resources>
</drools:kbase>
Here is the relevant part of the persistence.xml file:
<persistence-unit name="myAppH2">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.drools.persistence.info.SessionInfo</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.connection.autocommit" value="true" />
<property name="hibernate.transaction.manager_lookup_class" value= "org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
I have a jndi.properties that's identical to what's in the documentation<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/...>.
I noticed in the documentation (Example 3.65, Configuring JPA) that the persistence-unit block is defined a bit differently. In particular, transaction-type is specified and a jta-data-source are defined, unlike in my file:
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/BitronixJTADataSource</jta-data-source>
...
</persistence-unit>
I tried defining these as shown, but then the code failed on startup when it tried to create a transaction:
org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager: Unable to begin transaction
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.begin(DroolsSpringTransactionManager.java:48)
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:190)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:100)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:83)
at MyClass1.initializeKnowledgeSession
at MyClass1.initializeKnowledgeEngine
at MyClass2.main
Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:996)
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.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at com.sun.proxy.$Proxy16.getTransaction(Unknown Source)
at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:70)
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:377)
... 12 more
Thanks,
Tom
11 years, 6 months
IllegalStateException when disposing of a persisted session
by Thomas Grayson
We are using Drools persistence with a StatefulKnowledgeSession. The persistence itself works fine, but I am encountering an IllegalStateException when disposing of the StatefulKnowledgeSession. This happens with either a brand new session with no facts or one that has had facts added to it. It also happens with sessions that have been restored from the persistent store. The code does no explicit transaction management and relies on Drools to do this under the covers. We are using Drools 5.5.0 Final. How do I dispose of a session correctly?
The documentation<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/...> includes Example 3.66, "Configuring JTA DataSource." My code does not include code like this anywhere. Do I need it? It's not clear from the example where the PoolingDataSource instance would be used or when this code should be called. If this configuration is required, can it be done via Spring instead of programmatically?
I'll provide some supporting information below. I've edited these excerpts to redact some private details and eliminate distracting code, but the substance is intact.
Here is the stack trace created by invoking the "dispose" method from a shutdown hook:
java.lang.IllegalStateException: No value for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@732e3e73] bound to thread [Thread-3]
at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209)
at org.drools.container.spring.beans.persistence.DroolsSpringJpaManager.dispose(DroolsSpringJpaManager.java:135)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:345)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.dispose(CommandBasedStatefulKnowledgeSession.java:241)
at MyClass1.stop
at MyClass2$1.run
at java.lang.Thread.run(Unknown Source)
The code uses Drools-Spring to configure the knowledge base and Java code to initialize the knowledge session. We're using JPA, the Bitronix transaction manager, and the H2 database, basically as described in the documentation<http://docs.jboss.org/drools/release/5.5.0.Final/droolsjbpm-introduction-...>. Here is the code for creating the session:
ApplicationContext context = new ClassPathXmlApplicationContext(APPLICATION_CONTEXT_XML);
KnowledgeStoreService kstore = (KnowledgeStoreService) context.getBean("myAppKnowledgeStore");
KnowledgeBase kbase = ...; // initialized by Spring configuration
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, context.getBean("entityManagerFactory"));
env.set(EnvironmentName.TRANSACTION_MANAGER, context.getBean("txManager"));
StatefulKnowledgeSession ksession = kstore.newStatefulKnowledgeSession(kbase, null, env);
Here is the relevant portion of the Spring ApplicationContext.xml file:
<bean id="dataSourceH2"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost/~/myApp" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSourceH2" />
<property name="persistenceUnitName" value="myAppH2" />
</bean>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<drools:grid-node id="myAppEngineNode" />
<drools:kstore id="myAppKnowledgeStore" />
<drools:kbase id="myAppEngineKBase" node="MyAppEngineNode">
<drools:configuration>
<drools:assert-behavior mode="EQUALITY" />
</drools:configuration>
<drools:resources>
<drools:resource type="DRL" source="classpath:MyAppInternalRules.drl" />
<drools:resource type="DTABLE" source="classpath:MyAppRules.xls" >
<drools:decisiontable-conf input-type="XLS" worksheet-name="Sheet 1" />
</drools:resource>
<drools:resource type="DTABLE" source="classpath:MyAppRules.xls" >
<drools:decisiontable-conf input-type="XLS" worksheet-name="Sheet 2" />
</drools:resource>
</drools:resources>
</drools:kbase>
Here is the relevant part of the persistence.xml file:
<persistence-unit name="myAppH2">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.drools.persistence.info.SessionInfo</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.connection.autocommit" value="true" />
<property name="hibernate.transaction.manager_lookup_class" value= "org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
I have a jndi.properties that's identical to what's in the documentation<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/...>.
I noticed in the documentation (Example 3.65, Configuring JPA) that the persistence-unit block is defined a bit differently. In particular, transaction-type is specified and a jta-data-source are defined, unlike in my file:
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/BitronixJTADataSource</jta-data-source>
...
</persistence-unit>
I tried defining these as shown, but then the code failed on startup when it tried to create a transaction:
org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager: Unable to begin transaction
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:427)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
at org.drools.container.spring.beans.persistence.DroolsSpringTransactionManager.begin(DroolsSpringTransactionManager.java:48)
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:190)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:100)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:83)
at MyClass1.initializeKnowledgeSession
at MyClass1.initializeKnowledgeEngine
at MyClass2.main
Caused by: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:996)
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.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at com.sun.proxy.$Proxy16.getTransaction(Unknown Source)
at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:70)
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:377)
... 12 more
Thanks,
Tom
11 years, 6 months
Decision table invoked frm Spring app
by Raju Bandaru
Hi,
Am new to guvnor . I have created decision table based rules in guvnor which
is located in tomcat server and now i want to invoke that rule from my
sample spring application .
I don't know how to do that even searched lot but couldn't find any proper
answer so please help me its very urgent for me .
Concept is to invoke a decision table based rule created from guvnor from
spring application and modify it .
Please help me .
Regards,
Raju
--
View this message in context: http://drools.46999.n3.nabble.com/Decision-table-invoked-frm-Spring-app-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 6 months
Guvnor Rule Validation
by rjr201
I'm creating a system which embeds the Guvnor Guided Editor and uses the REST
API to allow the user to edit and create rules.
I can't trust the user to create syntactically correct rules. If they do
create an invalid rule then the whole package of rules will fail to compile.
I need to find a way to detect that a individual rule has broken, and point
the user to that rule. So they don't just sit there not understanding why
it's not working.
I can see that when using standalone Guvnor this wouldn't be a problem, as
the user would be able to see that the rule has a red cross next to it
meaning something is wrong with that rule.
Has anyone else had experience doing this? Is there a way to get the UUID of
the specific rule that is causing the package not to compile?
I've had thoughts about putting each rule in it's own package, and then
creating a layer in my code to hide this from the user. But that seems like
a hack.. and I suspect it would drastically effect the performance..
As always, thanks any help/advice anyone can give.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Rule-Validation-tp4024218.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 6 months