4 Replies Latest reply on Oct 25, 2011 3:26 AM by Derek Pang

    Unable to run example project as Java application

    Derek Pang Newbie



      I am new to JBPM. I have just finished installing it and am able to lauch Eclipse plugin UI. I have imported a couple of example projects to test and play around with. When I try to execute the process with 'run as java application' I get the following error:


      org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'

          at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:277)

          at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:262)

          at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:175)

          at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:153)

          at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:254)

          at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:182)

          at org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)

          at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)

          at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:40)

          at com.sample.ProcessTest.main(ProcessTest.java:24)

      Caused by: org.drools.RuntimeDroolsException: value '1.7' is not a valid language level

          at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.getDefaultLanguageLevel(JavaDialectConfiguration.java:161)

          at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:56)

          at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:273)

          ... 9 more


      Can anyone shed any light as to how this can be resolved? Am I missing plugins or Drools Rule Engine?

        • 1. Re: Unable to run example project as Java application
          Derek Pang Newbie

          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?



          • 2. Re: Unable to run example project as Java application
            Maciej Swiderski Master

            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.



            • 3. Re: Unable to run example project as Java application
              Derek Pang Newbie

              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.








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


                      } catch (Throwable t) {





                  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
                Derek Pang Newbie

                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.