it's me again. My description was a bit imprecise before. The file 'Sample.drl' should actually be deployed in the database. At least I selected the 'Sample.drl' in the Deployment tab of the eclipse plugin together with some java classes that my process or belonging drools rules need ('FireRulesActionHandler.java' and 'IntValue.java'). Then I deployed the process and the named files to the server and the "Deployment successful"-Dialog appeared.
The problem is that when running the process not all of the files are available. The 'FireRulesActionHandler" seems to be there because it is executed just fine but the 'Sample.drl' and the 'IntValue' class seem to be unavailable. I access the 'Sample.drl' through a FileInputStream now as a workaround:
Reader reader = new InputStreamReader(new FileInputStream("C:/Temp/Sample.drl"));but still the 'IntValue' class cannot be found by the JBPM webapp during execution of the process. The error stack says:
20:28:49,176 ERROR [[FacesServlet]] Servlet.service() for servlet FacesServlet threw exception
javax.faces.FacesException: Error calling action method of component with id taskform:transitionButton
Caused by: org.drools.rule.InvalidRulePackage: Unable to resolve ObjectType 'IntValue'
The 'Sample.drl' rule file, which contains the rules that are being fired by the FireRulesActionHandler, which is called during execution of the process, looks as follows:
package com.sample.action #package com.sample import org.jbpm.context.exe.ContextInstance; import org.jbpm.taskmgmt.def.Task; import org.jbpm.taskmgmt.exe.TaskInstance; import org.jbpm.taskmgmt.def.TaskMgmtDefinition; import org.jbpm.graph.exe.ProcessInstance; import org.jbpm.graph.exe.ExecutionContext; import com.sample.action.IntValue; rule "Check Number" when ci : ContextInstance() IntValue (intVal : value, value > 100) then ci.setVariable("number", "999"); System.out.println("Changed number!"); end
And as I said, when testing the whole process including firing rules and everything through the jbpm API without deploying it and using the web app then it is executing just fine...
The files should be stored somewhere in the database when they are being deployed right? But where exactly are they supposed to go?
Does anybody know why this is not working?
Many thanks in advance!
I have the exact same problem as well.
Option 1 (raises not found in database error)
Reader reader = new InputStreamReader(Main.class.getResourceAsStream("AmountRule.drl"));
Option 2 (raises classloader issues, imported classes in drl file are not found)
Reader reader = new InputStreamReader(new FileInputStream("D:/dev/iai/src/rules/AmountRule.drl"));
This is a very important issue as we are not able to mix the jBPM engine with the Rule Engine...
The project I am involved in requires both.
By the way, just executing the Rule file (DRL) from a main class works perfectly.
I am using the jbpm-starterskit-3.1.3.