[jboss-user] [jBPM] - Re: Unable to run example project as Java application

Derek Pang do-not-reply at jboss.com
Mon Oct 24 23:03:58 EDT 2011


Derek Pang [http://community.jboss.org/people/delbacca] created the discussion

"Re: Unable to run example project as Java application"

To view the discussion, visit: http://community.jboss.org/message/633406#633406

--------------------------------------------------------------
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();
    }

}
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/633406#633406]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111024/fa6102e4/attachment.html 


More information about the jboss-user mailing list