8 Replies Latest reply on Sep 21, 2010 3:47 PM by popsubhas

    JBPM and Drool sample application throwing an Exception.

    felixkjose

      Hi All,

       

      I have created a simple standalone project for JBPM and Drools. But when I run the application I am getting the following exception:

       

      Exception in thread "main"

      java.lang.NullPointerException

      at org.jbpm.jpdl.internal.activity.RulesActivity.execute(

      RulesActivity.java:51)

      at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(

      ExecuteActivity.java:60)

      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(

      ExecutionImpl.java:656)

      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(

      ExecutionImpl.java:616)

      at org.jbpm.pvm.internal.model.ExecutionImpl.start(

      ExecutionImpl.java:217)

      at org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(

      StartProcessInstanceCmd.java:61)

      at org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(

      StartProcessInstanceCmd.java:37)

      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(

      DefaultCommandService.java:42)

      at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(

      StandardTransactionInterceptor.java:54)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(

      EnvironmentInterceptor.java:53)

      at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(

      EnvironmentInterceptor.java:40)

      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(

      RetryInterceptor.java:55)

      at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(

      SkipInterceptor.java:43)

      at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceById(

      ExecutionServiceImpl.java:58)

      at com.felix.poc.MainDriver.main(

      MainDriver.java:40)

       

      Can anybody please tell me what can be the reason for this exception? I have attached my sample application with this. Please find the same and please give me a resolution.

        • 1. Re: JBPM and Drool sample application throwing an Exception.
          swiderski.maciej

          Hi,

           

          try to deploy your drl file together with jpdl.xml file.

           

          repositoryService.createDeployment().addResourceFromClasspath("hello_world.jpdl.xml").
          addResourceFromClasspath("checkAnalystAvailable.drl").
          deploy();
          

          HTH

          Maciej

          • 2. Re: JBPM and Drool sample application throwing an Exception.
            felixkjose

            Hi Maceij,

             

            Thank you very much, that problem got solved. Now I am getting another exception as follows:

             

            Exception in thread "main"

            org.jbpm.api.JbpmException:

            error: drl problem: [ERR 101] Line 1:0 no viable alternative at input '<'

            at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(

            ProblemList.java:175)

            at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(

            ProblemList.java:141)

            at org.jbpm.pvm.internal.repository.DeployerManager.deploy(

            DeployerManager.java:50)

            at org.jbpm.pvm.internal.repository.RepositorySessionImpl.deploy(

            RepositorySessionImpl.java:61)

            at org.jbpm.pvm.internal.cmd.DeployCmd.execute(

            DeployCmd.java:47)

            at org.jbpm.pvm.internal.cmd.DeployCmd.execute(

            DeployCmd.java:33)

            at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(

            DefaultCommandService.java:42)

            at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(

            StandardTransactionInterceptor.java:54)

            at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(

            EnvironmentInterceptor.java:53)

            at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(

            EnvironmentInterceptor.java:40)

            at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(

            RetryInterceptor.java:55)

            at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(

            SkipInterceptor.java:43)

            at org.jbpm.pvm.internal.repository.DeploymentImpl.deploy(

            DeploymentImpl.java:91)

            at com.felix.poc.MainDriver.main(

            MainDriver.java:33)

             

            Can you please give me resolution for the same?. I have tried with two types of rules files. And I am attaching both with this. Both the cases I am getting the same exception.

            • 3. Re: JBPM and Drool sample application throwing an Exception.
              swiderski.maciej

              Hi,

               

              I managed to run your process with following rule definition:

               

              rule "checkAnalystAvailable"
              
                when
              
                  analystFinder : com.felix.poc.AnalystFinder( analyst=="FELIX", 
              region == "BELGIUM" )
              
                then 
              
                   analystFinder.setAnalystAvailable( true );
              
                   System.out.println( "Checking.........." );
              
              end
              

              This was the only change required to run it properly.

               

              Cheers,

              Maciej

              • 4. Re: JBPM and Drool sample application throwing an Exception.
                felixkjose

                Hi Maceij,

                 

                Thank you very much. I have made the changes as you told and it starts working. Once again thanks alot.

                 

                 

                Hi All,

                 

                If anybody needs the sample program for JBPM and Drools please contact me I will share the same with all the dependencies jars..

                 

                Thank You and Regards,

                Felix K Jose

                • 5. Re: JBPM and Drool sample application throwing an Exception.
                  rebody

                  Hi Maciej,

                   

                  I am not good at drools.  Does it mean that jbpm4 couldn't fully support drools?  Should we open an issue for this?

                  • 6. Re: JBPM and Drool sample application throwing an Exception.
                    swiderski.maciej

                    No, jBPM supports Drools rules properly. There were just few small modifications in rule file and how it is deployed.

                     

                    So no need for an issue.

                    • 7. Re: JBPM and Drool sample application throwing an Exception.
                      sanjaykm

                      Hi Felix,

                       

                      Can you please share the application with all dependancies.

                       

                      Regards,

                      Sanjay

                      • 8. Re: JBPM and Drool sample application throwing an Exception.
                        popsubhas

                        Thanks Felix and Maciej.

                         

                        Download from Felix's post.

                         

                        Delete all jars except as following

                        ==============

                        log4j.jar

                        mail.jar

                        slf4j-api-1.5.8.jar

                        slf4j-log4j12.jar

                        spring.jar

                         

                        Copy these following jars from jBPM 4.4 distribution

                        =================

                        antlr-runtime.jar

                        antlr.jar

                        commons-collections.jar

                        core.jar

                        dom4j.jar

                        drools-api.jar

                        drools-compiler.jar

                        drools-core.jar

                        hibernate-core.jar

                        hsqldb.jar

                        javassist.jar

                        jbpm.jar

                        jta-1.1.jar

                        juel-api.jar

                        juel-engine.jar

                        juel-impl.jar

                        mvel2.jar

                         

                        Change the code as per Maciej

                        ========================

                         

                        repositoryService.createDeployment().addResourceFromClasspath("hello_world.jpdl.xml").
                        addResourceFromClasspath("checkAnalystAvailable.drl").
                         
                        deploy();
                        

                         

                        rule "checkAnalystAvailable"
                         
                          when
                         
                            analystFinder : com.felix.poc.AnalystFinder( analyst=="FELIX", 
                        region == "BELGIUM" )
                         
                          then 
                         
                             analystFinder.setAnalystAvailable( true );
                         
                             System.out.println( "Checking.........." );
                         
                        end
                        

                         

                        Run MainDriver.