7 Replies Latest reply on Apr 12, 2013 10:22 AM by toorop

    invalid package name

    stellina_rosa

      Hi,

      I tried to run the BabyStepExample of Salaboy blog and it's all ok. After this, I tried to create a similar example where the process start when I pass it a username and a password, and a drools file where I print a message ("Hi admin" if the user is the administrator, "Hi user" otherwise);

       

      It gives me this error:

       

       

       

      org.drools.RuntimeDroolsException: invalid package name

                at org.jbpm.compiler.ProcessBuilderImpl.buildProcess(ProcessBuilderImpl.java:175)

                at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:254)

                at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:430)

                at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:470)

                at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)

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

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

      [5,58]: [ERR 102] Line 5:58 mismatched input 'process' expecting '(' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-6-DROOLS_DEFAULT" in pattern org.drools.runtime.process.WorkflowProcessInstance

      [5,119]: [ERR 102] Line 5:119 mismatched input ')' expecting '(' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-6-DROOLS_DEFAULT" in pattern org.drools.runtime.process.WorkflowProcessInstance

      [5,120]: [ERR 102] Line 5:120 mismatched input 'kcontext' expecting ')' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-6-DROOLS_DEFAULT"

      [6,7]: [ERR 101] Line 6:7 no viable alternative at input 'return' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-6-DROOLS_DEFAULT"

      [6,58]: [ERR 101] Line 6:58 no viable alternative at input '"tipoUtente"' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-6-DROOLS_DEFAULT" in pattern equals

      [13,58]: [ERR 102] Line 13:58 mismatched input 'process' expecting '(' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-7-DROOLS_DEFAULT" in pattern org.drools.runtime.process.WorkflowProcessInstance

      [13,119]: [ERR 102] Line 13:119 mismatched input ')' expecting '(' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-7-DROOLS_DEFAULT" in pattern org.drools.runtime.process.WorkflowProcessInstance

      [13,120]: [ERR 102] Line 13:120 mismatched input 'kcontext' expecting ')' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-7-DROOLS_DEFAULT"

      [14,7]: [ERR 101] Line 14:7 no viable alternative at input 'return' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-7-DROOLS_DEFAULT"

      [14,50]: [ERR 101] Line 14:50 no viable alternative at input '"tipoUtente"' in rule "RuleFlow-Split-com.sample.bpmn.hello-5-7-DROOLS_DEFAULT" in pattern equals

      org.drools.compiler.ProcessLoadError: unable to parse xml : Exception class org.drools.RuntimeDroolsException : invalid package name

      java.lang.IllegalArgumentException: Could not parse knowledge.

                at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:58)

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

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

       

       

      I attached the project... could anyone help me please?

        • 1. invalid package name
          salaboy21

          Hi,

          Please verify that your rules file contains a package definition at the top of the file.

          If the problem is the Process, please compare with the one provided in the example to see that you are filling all the required attributes in the process tag.

          Another common mistake is to add the resource with a different type. You need to notice that when you are adding a resource to the knowledge builder you should change the ResourceType to the appropriate one.

          Greetings

          • 2. invalid package name
            stellina_rosa

            Hi Mauricio,

            I used the ProcessTest.java like in your examples, so I created the knowledge, I have add the resource like:

             

            KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

                                kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);

                                kbuilder.add(ResourceFactory.newClassPathResource("my_rules.drl"), ResourceType.DRL);

             

            The process start correctly, but the problem is in the drools file because it seems that the process never read it...

            I think that the problem is the package definition in the drools file... but I can't understand what is the right definition........ generally the name of the package is the folder that contains the files....... but in your example it isn't... the package where is my drools file is simple src/main/resource..... so... in the drools file what is the name of the package?

            • 3. invalid package name
              stellina_rosa

              I understand where is a problem: I have a rule like this:

               

              rule "is the admin"

                ruleflow-group "control"

                when

                     $process: WorkflowProcessInstance()

                     $u: User(usern == "rosa")

                then

                      System.out.println("Welcome Admin");

               

              end

               

               

              the problem is the $process: WorkflowProcessInstance(), because if I try to cancel it, the project works; if I wanted to compare a variable that an external usern gives me (and that I store in a variable of the process) with an Object User that I store in the session (like a little db... with ksession.insert(new User()).... how can I do? I thought that the only way to take variable from process was with "$process: WorkflowProcessInstance()"

              • 4. invalid package name
                salaboy21

                I'm not sure to understand the question can you clarify what are you trying to do?

                Greetings.

                • 5. invalid package name
                  stellina_rosa

                  Sure!

                  I have a frame(not a Human Task) where a user insert his username and his password; these information are stored in a map, called params, that I use to start the process; at the same time I store the information in the variables (that I create in the process definition) username and password. In this way I can compare the information stored in the variables with the information stored in a database (as an example, it is obvious that I did not create an external database, but I create in the ProcessTest.java class an object of type User, which I then stored in the session through ksession.insert); what I would do by the rules, is to compare the object created by me with the data that are passed to me from the outside: if they match then make a print ...

                   


                  • 6. Re: invalid package name
                    aneeque

                    Hi

                     

                    I am getting the same problem with a simple example based on script tasks. What should I do to resolve the issue?

                     

                    regards

                    Aneeque

                    • 7. Re: invalid package name
                      toorop

                      I have exactly the same problem when trying to add the Hello World example.

                       

                      I download the demo package, install it (ant install.demo), start it (ant start.demo) and then in eclipse I create the hello world example, I run it as a Java and in the console runs ok.

                       

                      Then, I transfer it to the Guvnor repository. And when there I try to build it, it gives me exactly the same problem.

                       

                      We are trying to evaluate if we use it for our company. Can you guys provide a simple, simple example where you can build from scratch a simple Hello World, that runs on eclipse, it is transferable to guvnor, you can modify it there, and later exercise it with the jbpm console....? This will be really valuable. I am eager to show my management that we can use jbpm, but with such documentation ...