[jboss-jira] [JBoss JIRA] Updated: (JBRULES-1009) Can't execute rules twice with a second classloader
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Sat Jul 14 23:39:03 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-1009?page=all ]
Mark Proctor updated JBRULES-1009:
----------------------------------
Fix Version/s: FUTURE
I think this is related to this:
FooClassLoader loader1 = new FooClassLoader(original);
Class instance1 = loader1.loadClass( "test.drools.classloader.Foo" );
FooClassLoader loader2 = new FooClassLoader(original);
Class instance2 = loader2.loadClass( "test.drools.classloader.Foo" );
System.out.println( instance1.isAssignableFrom( instance2 ) );
Notice the instances are not assignable. We generate bytecode field readers, and cache them by string name. Now I imagine the second instance is using that same cache with the code generated off the first classloader, and thus providing the error. I'm not sure how to fix this.... expect it's a point release fix now
> Can't execute rules twice with a second classloader
> ---------------------------------------------------
>
> Key: JBRULES-1009
> URL: http://jira.jboss.com/jira/browse/JBRULES-1009
> Project: JBoss Rules
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Reteoo
> Affects Versions: 4.0.0.MR3
> Reporter: Aaron Dixon
> Assigned To: Mark Proctor
> Priority: Minor
> Fix For: FUTURE
>
> Attachments: drools-test.zip
>
>
> I am trying to sequentially perform two rules executions using two
> different classloaders in the same VM. I create completely new state
> for each execution, yet I still fail on the second execution (the first execution succeeds). I
> believe this has to do with some internal static cached state that
> JBossRules is maintaining. An integration test is attached as an archived Eclipse project (zip).
> Exception thrown:
> Exception in thread "main" java.lang.ClassCastException: test.drools.classloader.FooShadowProxy
> at org.drools.base.test.drools.classloader.Foo$getName.getValue(Unknown Source)
> at org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:94)
> at org.drools.base.evaluators.StringFactory$StringEqualEvaluator.evaluate(StringFactory.java:85)
> at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:61)
> at org.drools.rule.LiteralConstraint.isAllowed(LiteralConstraint.java:82)
> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:121)
> at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:20)
> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159)
> at org.drools.reteoo.Rete.assertObject(Rete.java:175)
> at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
> at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:584)
> at org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:63)
> at test.drools.classloader.Driver.testRules(Driver.java:49)
> at test.drools.classloader.Driver.go(Driver.java:35)
> at test.drools.classloader.Driver.main(Driver.java:19)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list