We've discovered that if we create a class in Java corresponding to our
DerivedValues class, we do not get the error, however, this takes away
the flexibility we were trying to provide our Guvnor users.
Interestingly enough, if we put a print statement into the setter for
appID in the Java class, we DO NOT see the print message until the 52
record. It appears that Drools does not start looking for the Class
Definition until we've hit some sort of maximum limit of records in
Guvnor. Is there some limit (number of instances, memory, etc.)?
------------------------------
Message: 5
Date: Tue, 24 Aug 2010 09:30:37 -0700
From: "John Peterson" <john.peterson.gv3k(a)statefarm.com>
Subject: [rules-users] NoClassDefFoundError when inserting
Guvnor-declared Fact
To: <rules-users(a)lists.jboss.org>
Message-ID:
<D3A6E68928C9104BB815C83F43A36BDF0E27C9F1(a)WPSCV6NH.OPR.STATEFARM.ORG>
Content-Type: text/plain; charset="us-ascii"
I'm experiencing a stack trace error (which I've pasted below) with a
sample Drools/Guvnor application. I'm running version 5.0.1 right now.
Here's the scenario:
I have a Java application loading data (56 records right now) from a
flat file, creating objects (one per row), parsing the individual fields
on the file into the attributes of the objects, putting them into an
array, and then inserting them into my Guvnor session. In Guvnor, I
have a POJO model to receive the data plus a Declarative Model that
enables the Guvnor user to set derived values based on the input data.
There is a very basic rule that says the following (using the Guided
Editor):
When
AppData[ad]
Then
System.out.println("Creating DerivedValues for " +
ad.getAwards_id()); /* Added as Free Form DRL
Insert DerivedValues appID=ad.getAwards_ID();
System.out.println("DerivedValus for Awards_id " + dv.getAwardsID()); /*
Added as Free Form DRL
Essentially, for each Fact of AppData, I'm creating and linking it to a
Fact of DerivedValues that the user can add attributes to. I runs fine
for the first 51 rows, then blows up on the rule when it is processing
the 52 row (with 4 more to go after that). If I cut the file down to
only have 51 rows, it doesn't blow up. The error -
java.lang.NoClassDefFoundError: com/statefarm/DerivedValues is confusing
because it has used DerivedValues 51 times without issue up to this
point. I've been trying to a handle on this for a couple days without
any luck.
Here is my stack trace:
RuleAgent(default) INFO (Tue Aug 24 11:17:12 CDT 2010): Configuring with
newInstance=false, secondsToRefresh=-1
RuleAgent(default) INFO (Tue Aug 24 11:17:12 CDT 2010): Configuring
package provider : URLScanner monitoring URLs:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/com
.statefarm/LATEST
RuleAgent(default) INFO (Tue Aug 24 11:17:15 CDT 2010): Applying changes
to the rulebase.
RuleAgent(default) INFO (Tue Aug 24 11:17:16 CDT 2010): Adding package
called com.statefarm
(53 blank rows removed to save space)
Creating DerivedValues for 122932
DerivedValus for Awards_id 122932
Creating DerivedValues for 122440
DerivedValus for Awards_id 122440
Creating DerivedValues for 122433
DerivedValus for Awards_id 122433
Creating DerivedValues for 122295
DerivedValus for Awards_id 122295
Creating DerivedValues for 119677
DerivedValus for Awards_id 119677
Creating DerivedValues for 118089
DerivedValus for Awards_id 118089
Creating DerivedValues for 118055
DerivedValus for Awards_id 118055
Creating DerivedValues for 118047
DerivedValus for Awards_id 118047
Creating DerivedValues for 118001
DerivedValus for Awards_id 118001
Creating DerivedValues for 117969
DerivedValus for Awards_id 117969
Creating DerivedValues for 117750
DerivedValus for Awards_id 117750
Creating DerivedValues for 117685
DerivedValus for Awards_id 117685
Creating DerivedValues for 117679
DerivedValus for Awards_id 117679
Creating DerivedValues for 117607
DerivedValus for Awards_id 117607
Creating DerivedValues for 117520
DerivedValus for Awards_id 117520
Creating DerivedValues for 117492
DerivedValus for Awards_id 117492
Creating DerivedValues for 117432
DerivedValus for Awards_id 117432
Creating DerivedValues for 117413
DerivedValus for Awards_id 117413
Creating DerivedValues for 117292
DerivedValus for Awards_id 117292
Creating DerivedValues for 117230
DerivedValus for Awards_id 117230
Creating DerivedValues for 117137
DerivedValus for Awards_id 117137
Creating DerivedValues for 116971
DerivedValus for Awards_id 116971
Creating DerivedValues for 116748
DerivedValus for Awards_id 116748
Creating DerivedValues for 116662
DerivedValus for Awards_id 116662
Creating DerivedValues for 116579
DerivedValus for Awards_id 116579
Creating DerivedValues for 116101
DerivedValus for Awards_id 116101
Creating DerivedValues for 115834
DerivedValus for Awards_id 115834
Creating DerivedValues for 115730
DerivedValus for Awards_id 115730
Creating DerivedValues for 114885
DerivedValus for Awards_id 114885
Creating DerivedValues for 114837
DerivedValus for Awards_id 114837
Creating DerivedValues for 114760
DerivedValus for Awards_id 114760
Creating DerivedValues for 114728
DerivedValus for Awards_id 114728
Creating DerivedValues for 114652
DerivedValus for Awards_id 114652
Creating DerivedValues for 114317
DerivedValus for Awards_id 114317
Creating DerivedValues for 113944
DerivedValus for Awards_id 113944
Creating DerivedValues for 113908
DerivedValus for Awards_id 113908
Creating DerivedValues for 113251
DerivedValus for Awards_id 113251
Creating DerivedValues for 113230
DerivedValus for Awards_id 113230
Creating DerivedValues for 112949
DerivedValus for Awards_id 112949
Creating DerivedValues for 112397
DerivedValus for Awards_id 112397
Creating DerivedValues for 111749
DerivedValus for Awards_id 111749
Creating DerivedValues for 111313
DerivedValus for Awards_id 111313
Creating DerivedValues for 111035
DerivedValus for Awards_id 111035
Creating DerivedValues for 110646
DerivedValus for Awards_id 110646
Creating DerivedValues for 110617
DerivedValus for Awards_id 110617
Creating DerivedValues for 109918
DerivedValus for Awards_id 109918
Creating DerivedValues for 109821
DerivedValus for Awards_id 109821
Creating DerivedValues for 109439
DerivedValus for Awards_id 109439
Creating DerivedValues for 109154
DerivedValus for Awards_id 109154
Creating DerivedValues for 105709
DerivedValus for Awards_id 105709
Creating DerivedValues for 105333
DerivedValus for Awards_id 105333
Creating DerivedValues for 103269 <- appears to blow up when
creating/inserting the instance of DerivedValues
Exception in thread "main" java.lang.NoClassDefFoundError:
com/statefarm/DerivedValues
at ASMAccessorImpl_320797751282666636960.getValue(Unknown
Source)
at
org.mvel2.optimizers.dynamic.DynamicGetAccessor.optimize(DynamicGetAcces
sor.java:87)
at
org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAcces
sor.java:57)
at
org.mvel2.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.jav
a:170)
at
org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:3
7)
at
org.mvel2.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:
68)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:1
04)
at org.mvel2.MVEL.executeExpression(MVEL.java:978)
at
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
at
org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
at
org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:660)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemo
ry.java:627)
at com.statefarm.DroolsTest.main(DroolsTest.java:30)
Caused by: java.lang.ClassNotFoundException: com.statefarm.DerivedValues
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 16 more
********************************************