Unable to fire Rules
by hanumesh.m
Hi,
I am inserting message(fileName, fromQ,toQ,transType) to WorkingMemory.
fileName as "ABC-834-test-100.edi"
I am inserting 3 instances of TrasactionVO's to workingmemory as follows:
TransactionVO transVO = new TransactionVO("ABC-834", "ABC.834.EDI",
"ABC.834.XML", "834");
TransactionVO transVO1 = new TransactionVO("XYZ-834", "XYZ.834.EDI",
"XYZ.834.XML", "834");
TransactionVO transVO2 = new TransactionVO("834", "INBOUND.834.EDI",
"INBOUND.834.XML", "834");
In drl, which ever object of TransactionVO matches the fileName of Message,
then update Message's rest of the details with TransactionVO. But the rules
are not getting fired.
Follewed is the testCase and .drl file along with FactObjects.
TestCase:
-------------------------------------------------------------
package com.sample;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.FactException;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
import com.sample.MessageEA;
import com.sample.TransactionVO;
/**
* This is a sample file to launch a rule package from a rule source file.
*/
public class DroolsTest2 {
public static final void main(String[] args) {
try {
//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
MessageEA messageEA = new MessageEA();
messageEA.setFileName("ABC-834-test-100.edi");
workingMemory.insert( messageEA );
TransactionVO transVO = new TransactionVO("ABC-834",
"ABC.834.EDI", "ABC.834.XML", "834");
TransactionVO transVO1 = new TransactionVO("XYZ-834",
"XYZ.834.EDI", "XYZ.834.XML", "834");
TransactionVO transVO2 = new TransactionVO("834",
"INBOUND.834.EDI", "INBOUND.834.XML", "834");
workingMemory.insert( transVO );
workingMemory.insert( transVO1 );
workingMemory.insert( transVO2);
try{
workingMemory.fireAllRules();
}catch (FactException e ){
System.out.println("err: "+e.getMessage());
}catch(Exception ee){
System.out.println("Err2 : "+ee.getMessage());
}
System.out.println("fName: "+messageEA.getFileName());
System.out.println("frQ: "+messageEA.getFromQ());
System.out.println("toQ: "+messageEA.getToQ());
} catch (Throwable t) {
t.printStackTrace();
}
}
/**
* Please note that this is the "low level" rule assembly API.
*/
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/EATech.drl" ) );
//optionally read in the DSL (if you are using it).
//Reader dsl = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/mylang.dsl" ) );
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can also be used...
PackageBuilder builder = new PackageBuilder();
//this wil parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is for normal DRL.
builder.addPackageFromDrl( source );
//Use the following instead of above if you are using a DSL:
//builder.addPackageFromDrl( source, dsl );
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
}
-------------------------------------------
.drl file
package com.sample;
import com.sample.MessageEA;
import com.sample.TransactionVO;
rule "Process ALL"
no-loop
when
m:MessageEA()
p: TransactionVO(fileMask matches m.fileName)
then
System.out.println( "Reading Rule for ..." + p.getFileMask() );
m.setFromQ(p.getFrom_Q());
m.setToQ(p.getTo_Q());
m.setTransType(p.getTransType());
update( m );
end
------------------------------------------------------------------
MessageEA (private String transType, private String fileName,private String
fromQ, private String toQ)
TransactionVO(private String fileMask, private String from_Q,private String
to_Q,private String transType);
)
This testCase has executed only Once accurately. But from later on it
stopped working. Not able to file Rules..
I am doing wrong anywhere?
Please suggest.
Hanumesh M
--
View this message in context: http://www.nabble.com/Unable-to-fire-Rules-tp16486801p16486801.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 7 months
What the.... is happening?
by mmquelo massi
Sorry guys,
but I can't understand why u released 4.0.5 a couple of weeks ago, then u
suddenly released
a brand new "4.0.6" release few days ago (which I promptly downloaded) and
now u put back again
the "4.0.4"....???....
*Why???*
What is the stable one????
Does the svn is working?? Should we build from repository or shouldn't we?
Looking forward to hearing any news on this matter....
Thank you anyway.
Bye.
Massimiliano
16 years, 7 months
Does anyone know the answer to this ?
by Saleem Lakhani
Hi,
Can I keep two instances of the same class in working memory? I guess
'Yes'.
If yes then how do I access each instance separately in DSL?
I am doing this: workingMemory.assertObject(personA),
workingMemory.assertObject(personB);
e.g; Person exists = personA:Person()
Thanks
16 years, 7 months
Identify attributes with decision tables
by Jonathan Guéhenneux
hi,
I have no problem for this kind of rule :
rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end
but I would like to know what is the decision table for this small rule
rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end
I've tried a lot of syntax and I read the section abour the decision table in the manual but ididnt find anything.
_________________________________________________________________
Créez votre disque dur virtuel Windows Live SkyDrive, 5Go de stockage gratuit !
http://www.windowslive.fr/skydrive/
16 years, 7 months
(no subject)
by Jonathan Guéhenneux
hi,
I have no problem for this kind of rule :
rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end
but I would like to know what is the decision table for this small rule
rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end
I've tried a lot of syntax and I read the section abour the decision table in the manual but ididnt find anything.
_________________________________________________________________
Recevez tous vos e-mails sur un seul compte ! Créez une adresse Hotmail !
http://www.windowslive.fr/hotmail/default.asp
16 years, 7 months
RCP and Drools
by J Michael Dean
I have continued to try to isolate the problem that I have previously
described, where my RCP application that calls Drools runs properly,
but am unable to Unit test. Can reproduce the problem simply and am
hoping someone can lend some insight.
I started by creating a simple Drools project that had a JUnit 4 test
in it; this runs. It contains two java files and a DRL file. (Shown
at very bottom of this post)
I then created a Hello World RCP application from the Eclipse
templates. I copied the Drools project files (2 Java files and 1 DRL
file) into the same package as my RCP stuff. When I run the test, I
get the following error, which is exactly the same error I have been
getting with my much more complicated project:
java.lang.NullPointerException
at
org.mvel.optimizers.OptimizerFactory.<clinit>(OptimizerFactory.java:43)
at
org.drools.rule.builder.dialect.mvel.MVELDialect.init(MVELDialect.java:
142)
at org.drools.compiler.DialectRegistry.initAll(DialectRegistry.java:49)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:146)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:108)
at rcp_with_drool.mikeTest..setUp(mikeTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
460)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
673)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
386)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
196)
[MVEL] Notice: Possible incorrect version of ASM present (3.0
required). Disabling JIT compiler. Reflective Optimizer will be used.
I then removed all the source files relating to the RCP itself, and
the error persists. If I now remove the plugin dependencies from this
project from the build path, the problem goes away and the tests run.
If I add the plugin dependencies back into the project, the error
resumes. Finally, if I make my ORIGINAL Drools project depend on this
second one with the plugin dependencies, the test fails there too. If
I remove the plugin dependencies, the tests run.
The plugin dependencies are:
org.eclipse.ui
org.eclipse.swt
CodeProSWTFragment
org.eclipse.swt.carbon.macosx
org.eclipse.jface
org.eclipse.core.commands
org.eclipse.ui.workbench
org.eclipse.core.runtime
org.eclipse.osgi
org.eclipse.equinox.common
org.eclipse.core.jobs
runtime_registry_compatibility
org.eclipse.equinox.registry
org.eclipse.equinox.preferences
org.eclipse.core.contenttype
org.eclipse.equinox.app
Thanks for any assistance.
Here are the two java files and the rules file:
package rcp_with_drool;
import static org.junit.Assert.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.DroolsParserException;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import rcp_with_drool.DroolsTest.Message;
public class mikeTest {
public static RuleBase ruleBase;
public static WorkingMemory workingMemory;
public static Message message;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
message = new Message();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
Reader source = new
InputStreamReader
( DroolsTest.class.getResourceAsStream( "Sample.drl" ) );
PackageBuilder builder = new PackageBuilder();
try {
builder.addPackageFromDrl(source);
} catch (DroolsParserException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
Package pkg = builder.getPackage();
ruleBase = RuleBaseFactory.newRuleBase();
try {
ruleBase.addPackage( pkg );
} catch (Exception e) {
e.printStackTrace();
}
workingMemory = ruleBase.newStatefulSession();
}
@After
public void tearDown() throws Exception {
}
@Test
public void testMain() {
//Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.insert( message );
assertEquals("Message status set", message.getStatus(),
Message.HELLO);
workingMemory.fireAllRules();
assertEquals("Message status
set",message.getStatus(),Message.GOODBYE);
}
@Test
public void testMain1() {
//Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.insert( message );
assertEquals("Message status set", message.getStatus(),
Message.HELLO);
workingMemory.fireAllRules();
assertEquals("Message status
set",message.getStatus(),Message.GOODBYE);
}
@Test
public void testMain2() {
//Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.insert( message );
assertEquals("Message status set", message.getStatus(),
Message.HELLO);
workingMemory.fireAllRules();
assertEquals("Message status
set",message.getStatus(),Message.GOODBYE);
}
@Test
public void testMain3() {
//Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.insert( message );
assertEquals("Message status set", message.getStatus(),
Message.HELLO);
workingMemory.fireAllRules();
assertEquals("Message status
set",message.getStatus(),Message.GOODBYE);
}
}
package rcp_with_drool;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
/**
* This is a sample file to launch a rule package from a rule source
file.
*/
public class DroolsTest {
public static final void main(String[] args) {
try {
//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory =
ruleBase.newStatefulSession();
//go !
Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.insert( message );
workingMemory.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
/**
* Please note that this is the "low level" rule assembly API.
*/
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new
InputStreamReader( DroolsTest.class.getResourceAsStream( "/
Sample.drl" ) );
//optionally read in the DSL (if you are using it).
//Reader dsl = new
InputStreamReader( DroolsTest.class.getResourceAsStream( "/
mylang.dsl" ) );
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can also be
used...
PackageBuilder builder = new PackageBuilder();
//this wil parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is for normal
DRL.
builder.addPackageFromDrl( source );
//Use the following instead of above if you are using a DSL:
//builder.addPackageFromDrl( source, dsl );
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
public static class Message {
public static final int HELLO = 0;
public static final int GOODBYE = 1;
private String message;
private int status;
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return this.status;
}
public void setStatus( int status ) {
this.status = status;
}
}
}
package glucose.rules
import rcp_with_drool.DroolsTest.Message;
rule "Hello World"
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
m.setMessage( "Goodbye crueller world" );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
no-loop true
when
m : Message( status == Message.GOODBYE, message : message )
then
System.out.println( message );
m.setMessage( message );
end
16 years, 7 months
Problem when compiling rules in Jetty + Eclipse
by Augusto Rodriguez
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryRule Compilation error : [Rule name=insertion of versions, agendaGroup=MAIN, salience=0, no-loop=false]
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:52) : A method named "info" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : A method named "getLogger" is not declared in any enclosing class nor any supertype, nor through a static import
com/elixir/rules/Rule_insertion_of_versions_0.java (16:3) : Imported class "org.slf4j.LoggerFactory" could not be loaded
com/elixir/rules/Rule_insertion_of_versions_0.java (16:26) : Instance method "getLogger" cannot be invoked in static context
org.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactoryorg.slf4j.Loggerorg.slf4j.LoggerFactory
at org.drools.rule.Package.checkValidity(Package.java:424)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:384)
at com.elexir.rules.AvailabilityRulesEngineImpl.readRules(AvailabilityRulesEngineImpl.java:122)
at com.elexir.rules..availability.AvailabilityRulesEngineImpl.<init>(AvailabilityRulesEngineImpl.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:756)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:721)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:384)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:261)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:281)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1099)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1147)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:568)
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:441)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:173)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:154)
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:130)
at org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManagerFactory(EntityManagerFactoryUtils.java:94)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findNamedEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:442)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:425)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$AnnotatedMember.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:582)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$AnnotatedMember.resolve(PersistenceAnnotationBeanPostProcessor.java:553)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$AnnotatedMember.inject(PersistenceAnnotationBeanPostProcessor.java:489)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation(PersistenceAnnotationBeanPostProcessor.java:272)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:412)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:540)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1221)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:449)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at com.elixir.admin.web.RunServer.main(RunServer.java:26)
16 years, 7 months
anonsvn down?
by Markus Helbig
Hi,
i could not connect to the anonymous svn with subclipse plugin?
RA layer request failed
svn: PROPFIND request failed on '/labs/jbossrules/trunk'
svn: PROPFIND of '/labs/jbossrules/trunk': could not connect to server
(http://anonsvn.labs.jboss.com)
Cheers
Markus
16 years, 7 months
what is the current drools release?
by Godmar Back
What's the most current drools release?
There's discussion of 4.0.5 and 4.0.6 in the email below, which dates
from 26-Mar-2008, but
http://labs.jboss.com/drools/downloads.html lists 4.0.4 as having been
released 31-Mar-2008 and does not mention 4.0.5 and 4.0.6.
Thanks.
- Godmar
On Wed, Mar 26, 2008 at 9:20 AM, Mark Proctor <mproctor(a)codehaus.org> wrote:
> Sounds like when the MVEL author release 1.2.24 he didn't do a valid pom.xml
> - I'll let him know.
>
> There is also another problem with the 4.0.5 and the MVEL eclipse
> configuration - see email thread below. I'm going to push for a 4.0.6
> release next week, to address this.
> 1.2.25 or 1.2.24 is fine - as long as you always use the same version for
> everything, they aren't serialisation compatible.
>
> Sorry.
>
> Eric Miles wrote:
>
> > I am attempting to build a project using Maven2 with Drools 4.0.5 and
> > JDK 1.4. The MVEL dependency was downloaded and I'm getting an error
> > with it's pom:
> >
> > mvel-1.2.24-java1.4.pom
> > 3/26/08 8:51:09 AM EDT: Parsing
> > error
> /home/emiles/.m2/repository/org/mvel/mvel/1.2.24-java1.4/mvel-1.2.24-java1.4.pom;
> org.codehaus.plexus.util.xml.pull.XmlPullParserException: end tag name
> </pakaging> must match start tag name <packaging> from line 6 (position:
> TEXT seen ...<packaging>jar</pakaging>... @6:30) 3/26/08 8:51:09 AM EDT:
> Unable to read smarttime/pom.xml;
> > org.eclipse.core.runtime.CoreException: Parsing
> > error
> /home/emiles/.m2/repository/org/mvel/mvel/1.2.24-java1.4/mvel-1.2.24-java1.4.pom;
> org.codehaus.plexus.util.xml.pull.XmlPullParserException: end tag name
> </pakaging> must match start tag name <packaging> from line 6 (position:
> TEXT seen ...<packaging>jar</pakaging>... @6:30)
> >
> > I excluded version 1.2.24 and used 1.2.25 instead, which fixes my build
> > path errors. Is this version okay to use with Drools 4.0.5?
> >
> > Thanks!
> > Eric
> >
> >
> >
> The mvel release is screwed up.
>
> dependency>
> <groupId>org.mvel</groupId>
> <artifactId>mvel</artifactId>
> <version>1.2.24-java1.4</version>
> </dependency>
>
> Our mvel, for the 1.4 backport, has always been called mve14 - as we've
> done the releases ourselves in the past.
> <dependency>
> <groupId>org.mvel</groupId>
> <artifactId>mvel14</artifactId>
> <version>1.2.21</version>
> </dependency>
>
> So now when eclipse does the version stripping it includes mvel.jar and not
> mvel14.jar, leaving it screwed.
>
> Mark
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
16 years, 7 months
Rule Compilation - Thread deadlock possibility?
by Krishna Satya
I have a class DroolsRuleLocator that fetches rules from the database,
compiles and hands me back the RuleBase. At this time I have just one rule
file with a bunch of rules in them. I do not experience any issues when I
execute that in a single thread.
But when I load test my application and the client is passing in the request
that requires *lookup and compilation of the same rule source in my server
concurrently but on different threads,* it appears that my application is
dead locked trying to compile the rules.
Relevant Rule compilation code:
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
try {
// Rule is a simple java bean containing the rule text.
for (Rule rule : rules) {
// ruleDefinition will contain the contents of the drl
source.
String ruleDefinition = rule.getRuleText();
PackageBuilder builder = new PackageBuilder();
// Parse and compile in one step
builder.addPackageFromDrl(new StringReader(ruleDefinition));
if (builder.hasErrors()) {
throw new RuntimeException("Unable to compile rule
definition: "+ rule.getName());
}
// Get the compiled package (which is serializable)
Package pkg = builder.getPackage();
// Add the package to the created rulebase (deploy the rule
package).
ruleBase.addPackage(pkg);
}
}
Remote attaching to the tomcat server and suspending the hanging threads
shows the following trace.
Daemon Thread [http-8080-58] (Suspended)
owns: PhaseInterceptorChain (id=315)
waiting for: StandardClassLoader (id=244)
owned by: Daemon Thread [http-8080-62]
(Running)
StandardClassLoader(ClassLoader).loadClass(String, boolean)
line: not available
StandardClassLoader(ClassLoader).loadClass(String) line: not
available
WebappClassLoader.loadClass(String, boolean) line: 1349
WebappClassLoader.loadClass(String) line: 1208
ParserContext.checkForDynamicImport(String) line: 121
ParserContext.hasImport(String) line: 155
ExpressionCompiler(AbstractParser).createPropertyToken(int, int)
line: 893
ExpressionCompiler(AbstractParser).nextToken() line:
836
ExpressionCompiler._compile() line: 80
ExpressionCompiler.compile(ParserContext) line: 44
MVELExprAnalyzer.analyzeExpression(RuleBuildContext, String,
Set[], Map) line: 85
MVELDialect.analyzeExpression(RuleBuildContext, BaseDescr,
Object, Map) line: 320
MVELDialect.analyzeExpression(RuleBuildContext, BaseDescr,
Object) line: 308
MVELFromBuilder.build(RuleBuildContext, BaseDescr, Pattern)
line: 71
MVELFromBuilder.build(RuleBuildContext, BaseDescr) line: 50
PatternBuilder.build(RuleBuildContext, BaseDescr, Pattern) line:
172
PatternBuilder.build(RuleBuildContext, BaseDescr) line:
87
GroupElementBuilder.build(RuleBuildContext, BaseDescr, Pattern)
line: 69
RuleBuilder.build(RuleBuildContext) line: 53
PackageBuilder.addRule(RuleDescr) line: 446
PackageBuilder.addPackage(PackageDescr) line: 304
PackageBuilder.addPackageFromDrl(Reader) line: 167
DroolsRuleLocator.findRuleBase(long, String) line: 122
Can someone clarify if this dead lock scenario is a possibility. Currently
I am sychronizing on the method that compiles and returns the RuleBase to
avoid this situation.
Thanks.
- Krishna
16 years, 7 months