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
12 years, 1 month
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
12 years, 1 month
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.
12 years, 1 month
can't start jboss with enable=true option for resource-change-scanner
by eselis
Hello,
I have an application that use Guvnor 5.4.0 final as a process repository,
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. I want
that my app gets the new processes without restarting the container (another
Jboos-EAPv6).
I found that the solution should be to add this to my configuration xml
/<drools:resource-change-scanner id="scanner" interval="10" enabled="true"
/> /
I added it, but when I want to startup my app, I have the following mistake
related to the line wrote above.
/nested exception is org.xml.sax.SAXParseException; lineNumber: 18;
columnNumber: 77; cvc-complex-type.3.2.2: Attribute 'enabled' is not allowed
to appear in element 'drools:resource-change-scanner'/
I tried to use without the option enable="true" but I didn't get the new
processes unless I restart jboss. Does anybody have any idea to help me?
Thanks in advance,
--
View this message in context: http://drools.46999.n3.nabble.com/can-t-start-jboss-with-enable-true-opti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Nurse rostering configuration with competition.xsd schema
by adc
I am modelling a personnel rostering based on Nurse Rostering.
I am toying with the *.xml samples based on the competition.xsd schema. The
schema is in general very clear, but there are so many configuration
parameters that I am not sure how to properly configure each of them. For
instance, I cannot figure out how to correctly set up the patterns and their
usage in the contracts tags.
The aim is to correctly model my scenario .xml file in order to avoid
unnecessary contraints and to correctly weight the useful ones.
So, I am looking for some detailed references about the competition.xsd
schema, and maybe a tutorial about the usage of the schema.
Any clue?
Thanks, Alberto
--
View this message in context: http://drools.46999.n3.nabble.com/Nurse-rostering-configuration-with-comp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month