Classcast exception in Drools ant task
by Mutyala Suresh kumar
Hi All,
I am trying to build a sample drools project using ant and getting the below error. I am using "drools-distribution-5.4.0.Final" release jars in my project. Unable to get this issue resolved as not sure what really went wrong.
RuleBaseTask failed: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel:org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration'
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:159)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1307)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:33)
at org.apache.tools.ant.Project.executeTargets(Project.java:1191)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel:org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:313)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:187)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:140)
at org.drools.contrib.DroolsCompilerAntTask.getPackageBuilder(DroolsCompilerAntTask.java:556)
at org.drools.contrib.DroolsCompilerAntTask.createWithPackageBuilder(DroolsCompilerAntTask.java:266)
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
... 2 more
Caused by: java.lang.ClassCastException: org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:308)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:298)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:189)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:142)
at org.drools.contrib.DroolsCompilerAntTask.getPackageBuilder(DroolsCompilerAntTask.java:558)
at org.drools.contrib.DroolsCompilerAntTask.createWithPackageBuilder(DroolsCompilerAntTask.java:266)
at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1307)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:33)
at org.apache.tools.ant.Project.executeTargets(Project.java:1191)
... 2 more
Below is the list of jars added to my classpath,
--------------------------------------------
antlr-runtime.jar
drools-ant-5.4.0.Final.jar
drools-compiler-5.4.0.Final.jar
drools-core-5.4.0.Final.jar
drools-decisiontables-5.4.0.Final.jar
drools-jsr94-5.4.0.Final.jar
drools-persistence-jpa-5.4.0.Final.jar
drools-templates-5.4.0.Final.jar
drools-verifier-5.4.0.Final.jar
droolsjbpm-ide-common-5.4.0.Final.jar
jbpm-bpmn2.jar
jbpm-flow-builder.jar
jbpm-flow.jar
jsr94.jar
junit.jar
jxl.jar
knowledge-api.jar
knowledge-internal-api.jar
mvel2.jar
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar
xmlpull.jar
xpp3_min.jar
xstream.jar
build.xml
---------
<project name="DroolsProto" default="dist" basedir=".">
<property name="build.src" location="src"/>
<property name="build.target" location="target"/>
<property name="build.dist" location="dist"/>
<path id="build.lib.path">
<fileset dir="${build.src}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="droolscompiler" classname="org.drools.contrib.DroolsCompilerAntTask">
<classpath refid="build.lib.path"/>
</taskdef>
<target name="clean">
<delete dir="${build.target}"/>
<delete dir="${build.dist}"/>
</target>
<target name="init">
<tstamp/>
<mkdir dir="${build.target}"/>
<mkdir dir="${build.dist}"/>
<record name="build.log" loglevel="verbose" append="false"/>
</target>
<target name="compile" depends="init">
<mkdir dir="${build.target}/classes"/>
<javac srcdir="${build.src}/main/java" destdir="${build.target}/classes">
<classpath refid="build.lib.path"/>
<include name="**/*.java"/>
</javac>
</target>
<target name="compile-rules">
<property name="pathelements" refid="build.lib.path"/>
<droolscompiler srcDir="${build.src}/main/rules"
toFile="${build.target}/classes/drl.pkg"
classpathref="build.lib.path">
<include name="*.drl" />
</droolscompiler>
</target>
<target name="bundle-resources" depends="compile-rules">
<copy todir="${build.target}/classes">
<fileset dir="${build.src}/main/resources"/>
</copy>
</target>
<target name="dist" depends="compile,bundle-resources"/>
</project>
Thanks in advance,
Suresh
13 years, 10 months
planning difficulty problem
by Ricardo
For example , I have 10 doctors planning for 3 hospitals in three shifts,
each hospital take maximum limit of 3 doctors only, In this case I have one
remaining doctor unassigned. My doubt is how planner handle this data? will
it be rejected or consider in other cycle or overwrite the planner solution?
please advise...
thanks,
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/planning-difficulty-problem-tp4019857.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
Persistence in fireUntilHalt() loop
by Alberto R. Galdo
Hi,
We're running an application that uses Drools + JBPM 5 + Drools
integration our set-up can be seen as:
Some rule fires and creates a JBPM process ( a fact gets inserted into
drools using "kcontext.getKnowledgeRuntime().startProcess("testProcess")"
). We have a problem with the persistence of this processes. Persistence is
implemented with JPA and JTA. Our application runs with fireUntilHalt() and
when a process is launched from the consequence of any of the rules the
persistence of the process fails. If the application runs with
fireAllRules(), the persistence works like a charm.
The error shown is as follow:
Exception in thread "Thread-5" Exception executing consequence for rule
"Run Process" in com.sample: java.lang.NullPointerException
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)
at
org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)
at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)
at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)
at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)
at com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)
at com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 6 more
The problem is in this function:
public void addProcessInstance(ProcessInstance processInstance) {
ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo(
processInstance, this.kruntime.getEnvironment() );
ProcessPersistenceContext context
= ((ProcessPersistenceContextManager)
this.kruntime.getEnvironment()
.get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
.getProcessPersistenceContext();
// @PrePersist added to ProcessInstanceInfo because of this
context.persist( processInstanceInfo );
((org.jbpm.process.instance.ProcessInstance)
processInstance).setId( processInstanceInfo.getId() );
processInstanceInfo.updateLastReadDate();
internalAddProcessInstance(processInstance);
}
We think after that persist sentence, the entity manager would have to run
a flush sentence for the process instance is inserted into database and get
the ID.
Greets.
13 years, 10 months
Re: [rules-users] exception jitting problem
by Mario Fusco
brendanneff wrote
>
> I read a few forum posts about updating to 5.4 CR1 (we're using 5.4
> Final), but wanted to ask and see if that's really the cause before I
> start changing the version. I also saw that casting as an Integer, which
> we do, could solve the problem. Could someone take a look at this and let
> me know if changing to CR1 would fix the issue or if there's a simpler
> solution?
>
I am afraid you misread some former email. I think nobody wrote (or at least
I couldn't find it) that using the 5.4.CR1 release instead of the 5.4.Final
could fix this problem. Quite the opposite actually. I fixed some of these
jitting issues we had between the CR1 and the Final and some others
(including the one you found) remained even in the Final release.
I think I've fixed all the outstanding jitting issues and these fixes will
be available in the upcoming 5.5 release (we are deploying the beta1 in
these days). However it would be great if I could reproduce the bugs you
found, both because I could check if they are actually fixed in the 5.5 and
possibly give you some more informed suggestions to workaround them in the
5.4. In order to do that, the only info I miss is how the CMVNewLoanBean
class is made. Could you please send its source code (or at least the parts
relevant for the 2 failing rules you have) ?
brendanneff wrote
>
> Here are the rules that seem to be causing the errors:
>
> rule "Cashcure - Average Monthly Income Less Than 1251"
> when
> $loan : CMVNewLoanBean( new
> Integer(getCustomer().getLatestEmployer().monthlySalary) < 1251)
> then
> $loan.setLenderError($loan.getCurrentLender().getName(), 20253);
> end
>
Out of curiosity, why do you create the new Integer there instead of just
doing:
CMVNewLoanBean( getCustomer().getLatestEmployer().monthlySalary < 1251)
Thanks for reporting this,
Mario
--
View this message in context: http://drools.46999.n3.nabble.com/exception-jitting-problem-tp4019763p401...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months
System problems
by paco
I am using Drools 5.4.0, guvnor 5.3.0 and default database.
I imported the rules with XML file (550 KB) in Guvnor. After I can check,
validate and test (with run analysis button) the rules without problems.
Everything works fine.
After when I import ed other rules XML file (30,000 KB), I realized that the
system becomes too slow and obviously I can no longer veifier, validate or
test my rules.
Please suggest
--
View this message in context: http://drools.46999.n3.nabble.com/System-problems-tp4018363.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 10 months