transaction rollback makes the knowledge session multiplicate the timers when executing a processs that has timers bound to human tasks
by Alberto R. Galdo
Attached you can find a test case that has the following behaviour:
First, there is a process that has two script tasks and one human task that
has bounded an interrupting timer.
The test case, first configures a persistent environment using Bitronix and
H2 ( this has been tested also using JBoss and PostgreSQL ), then a
knowledgebase is configured using the previous BPMN process definition,
then human task service and persistence are configured along with the
defautl human task handler, and an StatefulKnowledgeSession is created.
Then there's a loop of 10 cycles of:
- Begin transaction
- Start the process ( then it executes until the timer waits for 30 days
)
- commit or rollback ( if cycle % 2 )
After that, the serialized KnowledgeSession is retrieved from the database
using just JDBC, and then is rehydrated using ProtobufMarshaller.
Well, what you will be able to see is that rolling back transactions that
involved executing a process that had timers inside, made the timers
multiplicate in the session. ( You can see this by placing a breakpoint
into "ProtobufInputMarshaller [line: 154] -
readSession(MarshallerReaderContext, int, ExecutorService, Environment,
SessionConfiguration) " and inspecting the contents of the variable
_session ).
>From the code it is expected to find just 5 timers persisted, but when
rehydrating the session one can see that were created 46 timers !!. This is
really weird, but it is weirder to find that there is some kind of pattern
).
If you take a look at what is inside the protocol buffers serialized
version of the knowledge session you can find that there's a direct
relation between the groups in the focus_stack, which in the example is:
focus_stack {
group_name: "MAIN"
group_name: "MAIN"
group_name: "MAIN"
group_name: "MAIN"
group_name: "MAIN"
}
and the number of repetitions of each timer ( associated with each process
instance ) are multiple of the number of group_names in the agenda. For
example if there are 5 items in the focus_stack there will be no more than
2^4 ( 16 ) repetitions of each timer. But all timers are congruent with
2^x-1 where x is the number of group_name in the agenda.
In fact, if you leave the timer behind ( just by changing the process ) you
will still be able to find that when executed there are 5 !! group_name
inside the focus_stack.
I've created a bug in Jira JBPM-3831 :
https://issues.jboss.org/browse/JBPM-3831
Any insight?
Alberto R. Galdo
argaldo(a)gmail.com
13 years, 4 months
taskName does not allow special characters
by eselis
Hello,
I have an application that use Guvnor 5.4.0 final as a process repository
running in a JBOSS-EAPv6, BPMN2 processes are designed with Orix (v2.3.0),
both are running in a JBOSS-EAPv6.
In addition I have another app which consumes processes from Guvnor (running
in another Jboos-EAPv6) which lists tasks.
When I created a BPMN2 process, I used different type of tasks, but for
/TaskType=User/ I have two names to define: the name (which is visualized in
the designer) and the TaskName.
I can't use the same name because TaskName (inside ORIX) does not allow
special characters (spaces and accents) for example "Llamada al médico". If
I use a TaskName with special characters, then when I want to validate the
process, it fails due to /User Task has no task form defined/ and if I
define the form, changes are not saved.
So, my "solution" is to use diferent names (one for visualization and
another one for the taskname used by jbpm). But when I have to listed the
tasks in my app I need the name displayed in the designer (the one that is
visualized in the designer, and is listed within the Common area inside the
Task properties). I here is my problem, because I can get the nodes to have
the name attribute, but neither Task nor TaskSummary has a link to the node.
Any ideas?
Thanks in advance,
--
View this message in context: http://drools.46999.n3.nabble.com/taskName-does-not-allow-special-charact...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Re: [rules-users] ClassNotFound on class defined in drl with 5.5.0.CR1
by Willem van Asperen
Hi,
This was a good idea. Here is my test case:
public class TestCompilation {
private final static FileFilter RULES_FILES_FILTER = new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.getName().endsWith(".drl");
}
};
private void testCompilation() throws FileNotFoundException,
IOException {
KnowledgeBuilderConfiguration configuration =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(configuration);
File folder = new File("src/main/rules/");
for (File file : folder.listFiles(RULES_FILES_FILTER)) {
System.out.println("compiling "+file.getAbsolutePath());
kbuilder.add(ResourceFactory.newFileResource(file.getAbsolutePath()),
ResourceType.DRL);
}
System.out.println("saving");
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream("test.drl.compiled"));
out.writeObject( kbuilder.getKnowledgePackages());
out.close();
}
private KnowledgeBase testLoad() throws FileNotFoundException,
IOException, ClassNotFoundException {
Properties configProperties = new Properties();
KnowledgeBaseConfiguration knowledgeBaseConfiguration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(configProperties);
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(knowledgeBaseConfiguration);
ObjectInputStream in = new ObjectInputStream(new
FileInputStream("test.drl.compiled"));
System.out.println("loading");
kbase.addKnowledgePackages((Collection<KnowledgePackage>) in.readObject());
return kbase;
}
public static void main(String[] args) throws
FileNotFoundException, IOException, ClassNotFoundException {
TestCompilation testCompilation = new TestCompilation();
testCompilation.testCompilation();
testCompilation.testLoad();
}
}
The folder src/main/rules consists of a number of .drl files.
Compiling works fine.
This is the output:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
further details.
compiling
/home/willem/development/workspace/VCM/src/main/rules/planner-lock.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/executable-action-selection.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/block-times-3.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/planner-bridge.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/routeplan.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/shift-management-brabant.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/plan-first-object-in-route.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/operator-lock.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/block-times-route-call.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/shift-management.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/planner-process-data.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/plan-last-moment.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/operator-bridge.drl
compiling
/home/willem/development/workspace/VCM/src/main/rules/operator-management.drl
saving
loading
Exception in thread "main" java.lang.ClassNotFoundException:
vcm.planner.lock.standard.PossibleSlotLock
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at
org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:85)
at
org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:97)
at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
at java.io.ObjectInputStream.readClass(ObjectInputStream.java:1480)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1330)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.ConsequenceMetaData$Statement.readExternal(ConsequenceMetaData.java:61)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.ArrayList.readObject(ArrayList.java:733)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.ConsequenceMetaData.readExternal(ConsequenceMetaData.java:19)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at org.drools.rule.Rule.readExternal(Rule.java:207)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:195)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:58)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at org.drools.rule.Package.readExternal(Package.java:208)
at
org.drools.definitions.impl.KnowledgePackageImp.readExternal(KnowledgePackageImp.java:157)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.ArrayList.readObject(ArrayList.java:733)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
com.paconsulting.pase.test.TestCompilation.testLoad(TestCompilation.java:57)
at
com.paconsulting.pase.test.TestCompilation.main(TestCompilation.java:64)
The class PossibleSlotLock is just a locally declared fact class. It is
only being used in that particular .drl file. Every .drl file has it's
own package name.
The head of the .drl file:
package vcm.planner.lock.standard;
import java.util.Set;
import com.paconsulting.pase.core.schedule.CurrentTime;
import com.paconsulting.pase.core.duration.FixedDuration;
import com.paconsulting.pase.transport.agents.ScheduleManagingContainer;
import com.paconsulting.pase.transport.agents.movers.Ship;
import com.paconsulting.pase.transport.agents.water.Lock;
import com.paconsulting.pase.transport.agents.water.LockChamber;
import com.paconsulting.pase.transport.agents.base.WaterLevel;
import com.paconsulting.pase.transport.components.action.ActionFactory;
import com.paconsulting.pase.transport.actions.IAction;
import com.paconsulting.pase.transport.components.action.IActionable;
import com.paconsulting.pase.transport.actions.NonTransactionAction;
import com.paconsulting.pase.transport.actions.ExecutableAction;
import com.paconsulting.pase.transport.components.containing.IContainer;
import
com.paconsulting.pase.transport.components.containing.IContainer.UpDown;
import com.paconsulting.pase.transport.components.moving.IMover;
import com.paconsulting.pase.transport.components.moving.TransferSchedule;
import com.paconsulting.pase.transport.components.moving.ToScheduleLock;
declare PossibleSlotLock
ship : IMover
chamber : IContainer
side : IContainer.UpDown
schedule : TransferSchedule
eta : double
at : double
cause : String
end
....
Same issue like in my previous email, different class that cannot be found.
This works in 5.4.0.Final
Any clue?
This seems to me like a really basic thing so either I am missing the
plot somehow or no-one has yet used a locally declared fact classes -
which I think is just not true...
Regards,
Willem
On 10/24/2012 07:29 PM, Wolfgang Laun wrote:
> It would be interesting to know (and perhaps help to isolate the problem
> apparently introduced in 5.5.0) if you could try and compile and
> serialize into a single file, and load that in a single readObject.
>
> -W
>
> On 24/10/2012, Willem van Asperen <willem(a)van.asperen.org> wrote:
>> Hi Wolfgang,
>>
>> Thanks for picking this up. I am indeed compiling these separate .drl
>> files into separate .drl.compiled files and then creating a kbase using
>> addKnowledgePackages on the individual .drl.compiled files.
>>
>> But: the classes declared in some of by .drl files are only going to be
>> used in that particular .drl file - not anywhere else.
>> Also: this did work in 5.4.0.Final but now has given up on me.
>>
>> Point is that I need to be flexible in mixing different .drl.compiled
>> files into a kbase, based on user specifications.
>> Alternative is that I do not pre-compile these .drl files and only
>> compile them, in combination, in the mix that is required by the user...
>> If that would solve the problem... But it seems to be more cumbersome...
>>
>> Regards,
>> Willem
>>
>> On 10/24/2012 03:39 PM, Wolfgang Laun wrote:
>>> The code you use for loading where you load many .pkg files isn't
>>> quite the counterpart for compiling where you compile one DRL.
>>>
>>> Do you compile and output the .drl files one by one? Apparently you
>>> load them individually?
>>>
>>> Try compiling them all, and then take the Collection<KnowledgePackage>
>>> and writeObject it to a single .pkg from which you load them in one
>>> go.
>>>
>>> Could it be that the type declared in one .drl is used in another .drl
>>> in the same package? Reading this in the wrong order might cause the
>>> CNF.
>>>
>>> -W
>>>
>>> On 24/10/2012, Willem van Asperen <willem(a)van.asperen.org> wrote:
>>>> Dear All,
>>>>
>>>> I use the Drools compiler to compile a set of drl files:
>>>>
>>>>
>>>> KnowledgeBuilder kbuilder =
>>>> KnowledgeBuilderFactory.newKnowledgeBuilder(configuration);
>>>> kbuilder.add(ResourceFactory.newFileResource(fileName),
>>>> ResourceType.DRL);
>>>>
>>>> KnowledgeBuilderErrors errors = kbuilder.getErrors();
>>>> if (errors.size() > 0) {
>>>> for (KnowledgeBuilderError error: errors) {
>>>> logger.error(error);
>>>> }
>>>> throw new IllegalArgumentException("Could not parse
>>>> knowledge.");
>>>> }
>>>>
>>>> ObjectOutputStream out = new ObjectOutputStream(new
>>>> FileOutputStream(fileName+".compiled"));
>>>> out.writeObject( kbuilder.getKnowledgePackages());
>>>> out.close();
>>>>
>>>> I then load these *.compiled files into my application:
>>>>
>>>>
>>>> for (String packageName : packages) {
>>>> InputStream is =
>>>> getClass().getResourceAsStream("/"+packageName+".drl.compiled");
>>>> if (is != null) {
>>>> logger.debug("adding package '"+packageName+"'");
>>>> ObjectInputStream in = new ObjectInputStream(is);
>>>> kbase.addKnowledgePackages((Collection<KnowledgePackage>)
>>>> in.readObject());
>>>> in.close();
>>>> } else
>>>> throw new FileNotFoundException("could not find
>>>> resource for package "+packageName);
>>>> is.close();
>>>> }
>>>>
>>>> In some of these drl files I declare a class, for instance:
>>>>
>>>> package vcm.selection.standard;
>>>>
>>>> import com.paconsulting.pase.transport.agents.ShiftWorker;
>>>> import com.paconsulting.pase.transport.agents.VCMShiftWorker;
>>>> import com.paconsulting.pase.transport.actions.ExecutableAction;
>>>> import com.paconsulting.pase.transport.agents.ScheduleManagingContainer;
>>>> import com.paconsulting.pase.transport.agents.water.Bridge;
>>>> import com.paconsulting.pase.transport.agents.movers.AbstractMover;
>>>> import com.paconsulting.pase.transport.agents.movers.Ship;
>>>> import com.paconsulting.pase.transport.agents.movers.VCMShip;
>>>>
>>>> declare RelevantExecutableAction
>>>> agent : ShiftWorker
>>>> executableAction : ExecutableAction
>>>> end
>>>> ...
>>>>
>>>> When running the
>>>> kbase.addKnowledgePackages((Collection<KnowledgePackage>)
>>>> in.readObject()) I get the following ClassNotFound stack trace:
>>>>
>>>> java.lang.ClassNotFoundException:
>>>> vcm.selection.standard.RelevantExecutableAction
>>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>>> at java.lang.Class.forName0(Native Method)
>>>> at java.lang.Class.forName(Class.java:264)
>>>> at
>>>> org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:85)
>>>> at
>>>> org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:97)
>>>> at
>>>> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593)
>>>> at
>>>> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
>>>> at
>>>> java.io.ObjectInputStream.readClass(ObjectInputStream.java:1480)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1330)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at
>>>> org.drools.rule.ConsequenceMetaData$Statement.readExternal(ConsequenceMetaData.java:61)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at java.util.ArrayList.readObject(ArrayList.java:733)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> at java.lang.reflect.Method.invoke(Method.java:601)
>>>> at
>>>> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
>>>> at
>>>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at
>>>> org.drools.rule.ConsequenceMetaData.readExternal(ConsequenceMetaData.java:19)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at org.drools.rule.Rule.readExternal(Rule.java:207)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at
>>>> org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:195)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at java.util.HashMap.readObject(HashMap.java:1155)
>>>> at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> at java.lang.reflect.Method.invoke(Method.java:601)
>>>> at
>>>> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
>>>> at
>>>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at
>>>> org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:58)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at org.drools.rule.Package.readExternal(Package.java:208)
>>>> at
>>>> org.drools.definitions.impl.KnowledgePackageImp.readExternal(KnowledgePackageImp.java:157)
>>>> at
>>>> java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at java.util.ArrayList.readObject(ArrayList.java:733)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>> at java.lang.reflect.Method.invoke(Method.java:601)
>>>> at
>>>> java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
>>>> at
>>>> java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
>>>> at
>>>> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
>>>> at
>>>> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
>>>> at
>>>> java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.definition.KnowledgebaseDefinition.addPackages(KnowledgebaseDefinition.java:48)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.definition.KnowledgebaseDefinition.materialize(KnowledgebaseDefinition.java:59)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.definition.TeamDefinition.materialize(TeamDefinition.java:97)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.definition.OperatingModelDefinition.materialize(OperatingModelDefinition.java:36)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.Run.<init>(Run.java:31)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.definition.RunDefinition.materialize(RunDefinition.java:53)
>>>> at
>>>> com.paconsulting.pase.core.configuration.runconfig.RunConfigExecutor$ScheduleExecutorWrapper.run(RunConfigExecutor.java:69)
>>>> ...
>>>>
>>>> I'm sure I miss something as this is basic functionality. Maybe I must
>>>> tell the kbase where to load the classes...
>>>>
>>>> Can someone point me in the right direction?
>>>>
>>>> Thanks,
>>>> Willem
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users(a)lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
13 years, 4 months
ClassCastException
by Ejaz Mohammed
Hello,
I'm getting class cast exception when I execute same rules with same fact
for more than 4 times.
If I catch the exception and reload the knowledge base from serialized
file, the problem is fixed.
However, I'm interested in root cause of the issue
Any advice?
Regards
Ejaz
13 years, 4 months
ClassNotFound on class defined in drl with 5.5.0.CR1
by Willem van Asperen
Dear All,
I use the Drools compiler to compile a set of drl files:
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(configuration);
kbuilder.add(ResourceFactory.newFileResource(fileName),
ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
logger.error(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream(fileName+".compiled"));
out.writeObject( kbuilder.getKnowledgePackages());
out.close();
I then load these *.compiled files into my application:
for (String packageName : packages) {
InputStream is =
getClass().getResourceAsStream("/"+packageName+".drl.compiled");
if (is != null) {
logger.debug("adding package '"+packageName+"'");
ObjectInputStream in = new ObjectInputStream(is);
kbase.addKnowledgePackages((Collection<KnowledgePackage>) in.readObject());
in.close();
} else
throw new FileNotFoundException("could not find
resource for package "+packageName);
is.close();
}
In some of these drl files I declare a class, for instance:
package vcm.selection.standard;
import com.paconsulting.pase.transport.agents.ShiftWorker;
import com.paconsulting.pase.transport.agents.VCMShiftWorker;
import com.paconsulting.pase.transport.actions.ExecutableAction;
import com.paconsulting.pase.transport.agents.ScheduleManagingContainer;
import com.paconsulting.pase.transport.agents.water.Bridge;
import com.paconsulting.pase.transport.agents.movers.AbstractMover;
import com.paconsulting.pase.transport.agents.movers.Ship;
import com.paconsulting.pase.transport.agents.movers.VCMShip;
declare RelevantExecutableAction
agent : ShiftWorker
executableAction : ExecutableAction
end
...
When running the
kbase.addKnowledgePackages((Collection<KnowledgePackage>)
in.readObject()) I get the following ClassNotFound stack trace:
java.lang.ClassNotFoundException:
vcm.selection.standard.RelevantExecutableAction
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at
org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:85)
at
org.drools.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:97)
at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
at java.io.ObjectInputStream.readClass(ObjectInputStream.java:1480)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1330)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.ConsequenceMetaData$Statement.readExternal(ConsequenceMetaData.java:61)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.ArrayList.readObject(ArrayList.java:733)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.ConsequenceMetaData.readExternal(ConsequenceMetaData.java:19)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at org.drools.rule.Rule.readExternal(Rule.java:207)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.JavaDialectRuntimeData.readExternal(JavaDialectRuntimeData.java:195)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.HashMap.readObject(HashMap.java:1155)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:58)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at org.drools.rule.Package.readExternal(Package.java:208)
at
org.drools.definitions.impl.KnowledgePackageImp.readExternal(KnowledgePackageImp.java:157)
at
java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at java.util.ArrayList.readObject(ArrayList.java:733)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at
com.paconsulting.pase.core.configuration.runconfig.definition.KnowledgebaseDefinition.addPackages(KnowledgebaseDefinition.java:48)
at
com.paconsulting.pase.core.configuration.runconfig.definition.KnowledgebaseDefinition.materialize(KnowledgebaseDefinition.java:59)
at
com.paconsulting.pase.core.configuration.runconfig.definition.TeamDefinition.materialize(TeamDefinition.java:97)
at
com.paconsulting.pase.core.configuration.runconfig.definition.OperatingModelDefinition.materialize(OperatingModelDefinition.java:36)
at
com.paconsulting.pase.core.configuration.runconfig.Run.<init>(Run.java:31)
at
com.paconsulting.pase.core.configuration.runconfig.definition.RunDefinition.materialize(RunDefinition.java:53)
at
com.paconsulting.pase.core.configuration.runconfig.RunConfigExecutor$ScheduleExecutorWrapper.run(RunConfigExecutor.java:69)
...
I'm sure I miss something as this is basic functionality. Maybe I must
tell the kbase where to load the classes...
Can someone point me in the right direction?
Thanks,
Willem
13 years, 4 months
Starting with Drools and EMF
by ordoabchao
Hi! i´m starting with Drools and EMF, so i decided to do a simple Drools
example and a simple EMF example.I tested it for separate and all worked
fine, so I tried to integrate both things. I added the path of the Drools
example to the EMF´s, but when I try to run i receive this message error:
Problems occurred when invoking code from plug-in: "org.eclipse.jface".
java.lang.NoClassDefFoundError: com/sample/Adapter
at Libreria.impl.clienteImpl.setNombre(clienteImpl.java:106)
at Libreria.impl.clienteImpl.eSet(clienteImpl.java:152)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1071)
at
org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand.doExecuteWithResult(SetValueCommand.java:74)
......
I don´t know what I´m doing wrong and I can´t find any example or practical
documentation to learn how to do Drools/EMF integration fine.
Could any one help me? salutes and thanks for all
--
View this message in context: http://drools.46999.n3.nabble.com/Starting-with-Drools-and-EMF-tp4020404....
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months