-
1. Re: Unable to run example project as Java application
delbacca Oct 24, 2011 6:06 AM (in response to delbacca)I am now getting this error (note: the error above was not resolved, just a new error now)
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
KnowledgeBase cannot be resolved to a type
The method readKnowledgeBase() from the type ProcessTest refers to the missing type KnowledgeBase
StatefulKnowledgeSession cannot be resolved to a type
KnowledgeRuntimeLogger cannot be resolved to a type
KnowledgeRuntimeLoggerFactory cannot be resolved
WSHumanTaskHandler cannot be resolved to a type
at com.sample.ProcessTest.main(ProcessTest.java:24)
If I look at the code, I get The import org.drools cannot be resolved.
How do I resolve this? Where can I find the references for this?
Thanks.
-
2. Re: Unable to run example project as Java application
swiderski.maciej Oct 24, 2011 12:04 PM (in response to delbacca)Looks like you are running Java 1.7?! Try to lower down the java version and run it once again.
Regarding types that cannot be resolved make sure you have all libraries that come with jBPM distrubution are available on your classpath. For instance, you can create user library in eclipse for all of them and link it to your project.
HTH
-
3. Re: Unable to run example project as Java application
delbacca Oct 24, 2011 11:03 PM (in response to swiderski.maciej)I have installed jdk 1.5 and still no joy. The sample project (evaluation) I load has the following error:
The import org.drools cannot be resolved. This is causing errors in the lines of code futher below where the following are used.
KnowledgeBase;
KnowledgeBuilder;
KnowledgeBuilderFactory;
ResourceType;
ResourceFactory;
KnowledgeRuntimeLogger;
Come can I create a library to of these namespaces?
---------------------------------------------------------------
package com.sample;
import java.util.HashMap;
import java.util.Map;
import org.drools.KnowledgeBase;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.process.workitem.wsht.WSHumanTaskHandler;
/**
* This is a sample file to launch a process.
*/
public class ProcessTest {
public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());
// start a new process instance
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "krisv");
params.put("reason", "Yearly performance evaluation");
ksession.startProcess("com.sample.evaluation", params);
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Evaluation.bpmn"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
}
-
4. Re: Unable to run example project as Java application
delbacca Oct 25, 2011 3:26 AM (in response to delbacca)I tried to run the ant install.demo command again and launched eclipse with no luck of being able to run the evaluation sample project. the jBPM library was not present. I tried to setup and install Apache ant, JBPM on another work station and was then able to load and run the project with the jBPM library present.