1 2 Previous Next 15 Replies Latest reply on Apr 18, 2011 8:35 AM by eaa

    Instantiating the KnowledgeBase

    jmfaerman

      The samples/docs instantiates the KnowledgeBase hard-coding the proccess definitions, like:

       

      {code}

      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

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

      {code}

       

      I am thinking that this approach is not usable for real applications, when new process are deployed in runtime.

      Is it possible to instantiate a KnowledgeBuilder that searches Guvnor for process definitions on-demand?

        • 1. Instantiating the KnowledgeBase
          voikonomidou

          Hi Julio,

           

          If you want to upload a knowledge base which includes the process definitions from guvnor repository the code you require is the following:

           

          ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());

          ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());        ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());

          BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());       

                 

          KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

          KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("testKAgent", aconf);      

                  kagent.applyChangeSet(

                          ResourceFactory.newUrlResource(

                          "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor"

                          + "/package/defaultPackage/LATEST/ChangeSet.xml"));

           

           

          And then you take the knowledgeBase from the KnowledgeAgent like this :

          KnowledgeBase kbase = kagent.getKnowledgeBase();

           

          In order to take the process you want from within the knowledgeBase you create a knowledgeSession :

          StatefulKnowledgeSession ksession =

                              JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);

           

          And finally something like  "ksession.getProcessInstances()" will gine you the collection of all the processes that lie inside the guvnor repository.

           

          Regards,

           

          Vasiliki.

          • 2. Re: Instantiating the KnowledgeBase
            carek

            I guess I have similiar problem. I wish to get all proccess definitions (NOT instances) from guvnor, but I don't know how to...

             

            above sample code:

             

            KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("testKAgent", aconf);       
                    kagent.applyChangeSet( 
                            ResourceFactory.newUrlResource(
                            "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor"
                            + "/package/defaultPackage/LATEST/ChangeSet.xml")); 
            
            
            And then you take the knowledgeBase from the KnowledgeAgent like this :
            KnowledgeBase kbase = kagent.getKnowledgeBase();
            

             

            claims that by applyChangeSet I can have those definitions in agent and than get it from him by getKnowledgeBase, but in changeSet.xml under that address is this:

             

            <change-set xs:schemaLocation="http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd">
            −
            <add>
            <resource source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" type="PKG"/>
            </add>
            </change-set>
            

             

            , but I guess packages doesn't includes processes definitions, so I tried to read from local changeset.xml, wrtten by me:

             

            <change-set xmlns='http://drools.org/drools-5.0/change-set'
                        xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
                        xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' >
                <add>
                    <resource source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages/defaultPackage' type='BPMN2'/>
                </add>
            </change-set>
            

             

            but that didn't work.

             

            I have guvnor running and in browser on address http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages/defaultPackage

            I can see:

             

            Contents of this Folder:
            drools.package
            test.bpmn2
            

             

            test.bpmn2 is correctly displayed in editor and created via guvnor... so everything is fine, except I don't know how can I download to my client from guvnor those definitions...

             

            anybody? I would be gratefull for any piece of advice

            • 3. Re: Instantiating the KnowledgeBase
              eaa

              We need to make a difference between 3 things:

              1. Process Definition (human-readable): this is the xml file where you define your process using BPMN2
              2. Process Definition (binary): this is the representation of your process definition using Objects of classes like Process, Node, etc. This is what you will find inside your knowledge base
              3. Process Instance (also binary): when you start or resume a process, you get the instance of it containing the state of the process.

               

              So, if you need your human-readable-process-definition in your application, then you can download it from guvnor using webdav.

              If you need the binary representation of your process, or maybe you need to get all the process names inside the kbase, then you will need to use kbase object to retrieve that information (Of course, this information will be available only after the agent processes the changeset).

               

              What we usually do, is to point the agent to the binary package created by guvnor (i.e. http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST). This package will already contain all the rules and process definitions inside.

              • 4. Re: Instantiating the KnowledgeBase
                carek

                Well my case is the second one. I'd like to read process definition and have it in KnowledgeBase, so that  I can run process, etc... but as I mentioned I was unable to get those processes... I don't know maybe I am doing something wrong. Here's my code snippets:

                 

                ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());
                ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());        ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
                BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());       
                KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("default guvnor agent");      
                kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
                kbase = kagent.getKnowledgeBase();
                

                 

                ChangeSet.xml:

                 

                <change-set xmlns='http://drools.org/drools-5.0/change-set'
                            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
                            xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd' >
                    <add>
                        <resource source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST' type='PKG'/>
                    </add>
                </change-set>
                

                 

                and when I want to list all loaded processes in index.jsp:

                 

                <% 
                     if (connector.kbase.getProcesses().size() > 0) {
                          for (Process proccess : connector.kbase.getProcesses()) {
                               out.println("Process " + proccess.getName() + " loadded succesfully");
                          }
                     } else {
                          out.println("No proccess loaded");
                     }
                %>
                

                 

                Else part is displayed. Do I need to do soemthing first in guvnor with this package? Some kind of export or what? Maybe it has something to do with this process status? Is Draft ok? I don't know. Any idea what could be wrong?

                • 5. Re: Instantiating the KnowledgeBase
                  eaa

                  Some basic questions (they may sound obvious, but they are important ):

                    • Are you building the package in guvnor? (click on the package name and click on "Build Package" button).
                    • Are you accesing kbase.getProcesses() AFTER the agent builds it?
                    • Are you checking for errors in the agent? (The first place to look at it the console log. Then you can use an KnowledgeAgentEventListener)
                  • 6. Re: Instantiating the KnowledgeBase
                    carek

                    1. Yes and the package is built successfully.

                    2. What do you mean by builds? If you mean that if the first code snippet is done before the third, than yes I do build the package before kbase.getProcesses()

                     

                    ProcessBuilderFactory.setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());
                    ProcessMarshallerFactory.setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());        ProcessRuntimeFactory.setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());
                    BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());       
                    KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("default guvnor agent");      
                    kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
                    kbase = kagent.getKnowledgeBase();
                    
                    

                     

                    this is a part of my connector's constructor... so the third snippet looks actually like that:

                     

                    <% 
                    
                         DatabaseConnector connector = DatabaseConnector();
                         if (connector.kbase.getProcesses().size() > 0) {
                              for (Process proccess : connector.kbase.getProcesses()) {
                                   out.println("Process " + proccess.getName() + " loadded succesfully");
                              }
                         } else {
                              out.println("No proccess loaded");
                         }
                    %>
                    
                    

                     

                    3. Yes I do... I have catch clause in which I set error variable and print it in index.jsp ... there's no error

                     

                    I have run out of ideas what could be wrong with my code

                    Is it possible that packages doesn't include processes? Only rules... I don't know... or maybe I have to add my processes to package somehow?

                     

                    When I click on show package source there's only one line:

                    1. | package defaultPackage

                     

                    Here are logs from console:

                     

                    23:21:04,444 INFO  [TransientRepository] Session opened
                    23:21:10,456 INFO  [TransientRepository] Session closed
                    23:21:37,349 INFO  [STDOUT] [2011:04:96 23:04:349:debug] KnowledgeAgent building resource map
                    23:21:37,350 INFO  [STDOUT] [2011:04:96 23:04:350:info] KnowledgeAgent created, with configuration:
                    monitorChangeSetEvents=true scanResources=true scanDirectories=true newInstance=true
                    23:21:37,353 INFO  [STDOUT] [2011:04:96 23:04:353:info] KnowledgeAgent has started listening for ChangeSet notifications
                    23:21:37,360 INFO  [STDOUT] [2011:04:96 23:04:360:info] KnowledgeAgent applying ChangeSet
                    23:21:37,364 INFO  [STDOUT] [2011:04:96 23:04:364:debug] KnowledgeAgent notifier subscribing to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
                    23:21:37,364 INFO  [STDOUT] [2011:04:96 23:04:364:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@15c64f6 to resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
                    23:21:37,364 INFO  [STDOUT] [2011:04:96 23:04:364:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
                    23:21:37,371 INFO  [TransientRepository] Session opened
                    23:21:37,373 INFO  [TransientRepository] Session closed
                    23:21:37,377 INFO  [TransientRepository] Session opened
                    23:21:37,378 INFO  [NilAuthenticator] All users are guests.
                    23:21:37,379 INFO  [RepositoryServlet] null authenticated for rest api
                    23:21:37,379 INFO  [RepositoryServlet] PackageName: defaultPackage
                    23:21:37,379 INFO  [RepositoryServlet] PackageVersion: LATEST
                    23:21:37,379 INFO  [RepositoryServlet] PackageIsLatest: true
                    23:21:37,380 INFO  [RepositoryServlet] PackageIsSource: false
                    23:21:37,382 INFO  [STDOUT] [2011:04:96 23:04:382:debug] KnowledgeAgent obtaining pkg resource=[UrlResource path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST']
                    23:21:37,382 INFO  [STDOUT] [2011:04:96 23:04:382:debug] KnowledgeAgent adding KnowledgeDefinitionsPackage defaultPackage
                    23:21:37,383 INFO  [STDOUT] [2011:04:96 23:04:383:info] KnowledgeAgent new KnowledgeBase now built and in use
                    23:21:37,383 INFO  [STDOUT] [2011:04:96 23:04:383:debug] KnowledgeAgent finished rebuilding KnowledgeBase using ChangeSet
                    

                     

                    So there's clearly nothing in the package I guess... at least if this whole building isn't done in the background asynchronously and maybe I call getProcesses to early I don't know...

                    • 7. Re: Instantiating the KnowledgeBase
                      carek

                      I have been debuging the code posted by vasiliki oikonomidou in the second post and there's really nothing in the package... Steps I took:

                       

                      1. I created process in defaultPackage

                      2. I build the package in guvnor

                      3. Paste code into simple class with main method only from the second post

                      4. After applyChangeSet in agent in variable named pkgs in ruleBase in kbase in kagent defaultPackage appeared, below I noticed processes variable... it's still empty

                      5. Code passed with no errors

                       

                      Please does anybody make something similiar? I need to do that for this Tuesday.

                       

                      What else can I do?

                      • 8. Re: Instantiating the KnowledgeBase
                        eaa

                        That is really wierd. The steps look correct. Could you please also define a rule in defaultPakcage and see if it is being added to the binary package? Maybe there is a problem with processes, but I'm sure it works for rules.

                        • 9. Re: Instantiating the KnowledgeBase
                          carek

                          finally I found something that maybe wil help...

                           

                          I tried to add some rules to the package as you suggested and rules are working great. I can see all of them in webdav and in my application through packages from kbase from the agent. Models and everything else works good also, so I thought that maybe I need to change something in process editor and well after creating again Hello process I changed one component in it by editing "Hello" to "Hello World" and save it... and that was the thing I should have done first... after saving process I tried to build package again... that's what I get in the console:

                           

                          20:20:56,486 INFO  [STDOUT] (null: 2, 351): cvc-elt.1: Cannot find the declaration of element 'bpmn2:definitions'.
                          20:20:56,489 INFO  [STDOUT] (null: 27, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:56,489 INFO  [STDOUT] (null: 28, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:56,490 INFO  [STDOUT] (null: 34, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:56,490 INFO  [STDOUT] (null: 35, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:57,294 INFO  [STDOUT] INFO  10-04 20:20:57,293 (NilAuthenticator.java:authenticate:36)      All users are guests.
                          20:20:57,333 INFO  [STDOUT] (null: 2, 351): cvc-elt.1: Cannot find the declaration of element 'bpmn2:definitions'.
                          20:20:57,337 INFO  [STDOUT] (null: 27, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:57,338 INFO  [STDOUT] (null: 28, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:57,340 INFO  [STDOUT] (null: 34, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:20:57,341 INFO  [STDOUT] (null: 35, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:21:04,957 INFO  [STDOUT] (null: 2, 351): cvc-elt.1: Cannot find the declaration of element 'bpmn2:definitions'.
                          20:21:04,960 INFO  [STDOUT] (null: 27, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:21:04,960 INFO  [STDOUT] (null: 28, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:21:04,961 INFO  [STDOUT] (null: 34, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:21:04,961 INFO  [STDOUT] (null: 35, 63): cvc-elt.4.2: Cannot resolve 'dc:Point' to a type definition for element 'di:waypoint'.
                          20:21:04,962 ERROR [STDERR] org.drools.RuntimeDroolsException: invalid package name
                          20:21:04,963 ERROR [STDERR]     at org.jbpm.compiler.ProcessBuilderImpl.buildProcess(ProcessBuilderImpl.java:175)
                          20:21:04,963 ERROR [STDERR]     at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:254)
                          20:21:04,963 ERROR [STDERR]     at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:430)
                          20:21:04,963 ERROR [STDERR]     at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:442)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.contenthandler.BPMN2ProcessHandler.compile(BPMN2ProcessHandler.java:217)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.builder.ContentPackageAssembler.buildAsset(ContentPackageAssembler.java:227)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.builder.ContentPackageAssembler.buildPackage(ContentPackageAssembler.java:212)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.builder.ContentPackageAssembler.<init>(ContentPackageAssembler.java:122)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.ServiceImplementation.buildPackage(ServiceImplementation.java:1588)
                          20:21:04,964 ERROR [STDERR]     at org.drools.guvnor.server.ServiceImplementation.buildPackage(ServiceImplementation.java:1565)
                          20:21:04,965 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          20:21:04,965 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                          20:21:04,965 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                          20:21:04,965 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:616)
                          20:21:04,965 ERROR [STDERR]     at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                          20:21:04,966 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          20:21:04,967 ERROR [STDERR]     at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                          20:21:04,967 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          20:21:04,967 ERROR [STDERR]     at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:157)
                          20:21:04,967 ERROR [STDERR]     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                          20:21:04,967 ERROR [STDERR]     at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                          20:21:04,968 ERROR [STDERR]     at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
                          20:21:04,968 ERROR [STDERR]     at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
                          20:21:04,968 ERROR [STDERR]     at org.drools.guvnor.server.ServiceImplementation_$$_javassist_4.buildPackage(ServiceImplementation_$$_javassist_4.java)
                          20:21:04,968 ERROR [STDERR]     at org.drools.guvnor.server.RepositoryServiceServlet.buildPackage(RepositoryServiceServlet.java:312)
                          20:21:04,968 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          20:21:04,968 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                          20:21:04,969 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                          20:21:04,969 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:616)
                          20:21:04,969 ERROR [STDERR]     at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
                          20:21:04,969 ERROR [STDERR]     at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
                          20:21:04,969 ERROR [STDERR]     at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
                          20:21:04,969 ERROR [STDERR]     at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
                          20:21:04,970 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
                          20:21:04,970 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                          20:21:04,970 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                          20:21:04,970 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          20:21:04,970 ERROR [STDERR]     at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
                          20:21:04,970 ERROR [STDERR]     at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
                          20:21:04,971 ERROR [STDERR]     at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
                          20:21:04,971 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          20:21:04,971 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          20:21:04,971 ERROR [STDERR]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                          20:21:04,971 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          20:21:04,972 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          20:21:04,972 ERROR [STDERR]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                          20:21:04,972 ERROR [STDERR]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                          20:21:04,972 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                          20:21:04,972 ERROR [STDERR]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                          20:21:04,972 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                          20:21:04,973 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                          20:21:04,973 ERROR [STDERR]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                          20:21:04,973 ERROR [STDERR]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                          20:21:04,973 ERROR [STDERR]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                          20:21:04,973 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                          20:21:04,974 ERROR [STDERR]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                          20:21:04,974 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                          20:21:04,974 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                          20:21:04,974 ERROR [STDERR]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                          20:21:04,975 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:636)
                          20:21:04,988 INFO  [STDOUT] INFO  10-04 20:21:04,987 (LoggingHelper.java:info:51)      Following assets have been included in package build: drools, test, rule, testModel, 
                          

                           

                          and this:

                          unable to parse xml:exception class org.drools.runtimedroolsexception : invalid package name

                          appeared below build package button.

                           

                          Unfortunatelly the only thing I understand from this is that there's everything all right with guvnor etc... and processes are the source of the problem :] Nevertheless I hope that it will give you a clue what's wrong... So, Any suggestions?

                           

                          PS. I don't know why but the last line of logs tells that process was added to the package(process name is test), but it's blank as I can see in webdav and it's not added to processes collection in kbase.

                           

                          Once again one hundred thanks for help

                          • 10. Re: Instantiating the KnowledgeBase
                            eaa

                            Could you please provide us the process xml? What is the name of the package were your process is defined? Is it defaultPackage?

                            • 11. Re: Instantiating the KnowledgeBase
                              carek

                              yeap it's in defaultPackage, however adding process to any other package and saving it doesn't change anything... the problem is the same... here's xml:

                               

                              <bpmn2:definitions id="12345" name="" targetNamespace="http://www.omg.org/bpmn20">
                              −
                              <bpmn2:process id="_18gPMGOeEeC-5r7T89MfkA" name="">
                              −
                              <bpmn2:startEvent id="_D469B734-5518-46B2-9AEB-C4D2ABFD4E9D" name="Start">
                              <bpmn2:outgoing>_4A5065B3-8B33-4B45-A2E0-0D4B589A0558</bpmn2:outgoing>
                              </bpmn2:startEvent>
                              −
                              <bpmn2:scriptTask id="_50EEF545-CD3F-487B-BAA1-37DF671E1410" name="Hello World" scriptFormat="Java">
                              <bpmn2:incoming>_4A5065B3-8B33-4B45-A2E0-0D4B589A0558</bpmn2:incoming>
                              <bpmn2:outgoing>_EE09B72D-655B-4D1B-A831-25C7E393B4E0</bpmn2:outgoing>
                              <bpmn2:script>System.out.println("Hello");</bpmn2:script>
                              </bpmn2:scriptTask>
                              <bpmn2:sequenceFlow id="_4A5065B3-8B33-4B45-A2E0-0D4B589A0558" name="" sourceRef="_D469B734-5518-46B2-9AEB-C4D2ABFD4E9D" targetRef="_50EEF545-CD3F-487B-BAA1-37DF671E1410"/>
                              −
                              <bpmn2:endEvent id="_3716BA1C-AF84-4A46-9486-A98B758D2227" name="End">
                              <bpmn2:incoming>_EE09B72D-655B-4D1B-A831-25C7E393B4E0</bpmn2:incoming>
                              </bpmn2:endEvent>
                              <bpmn2:sequenceFlow id="_EE09B72D-655B-4D1B-A831-25C7E393B4E0" name="" sourceRef="_50EEF545-CD3F-487B-BAA1-37DF671E1410" targetRef="_3716BA1C-AF84-4A46-9486-A98B758D2227"/>
                              </bpmn2:process>
                              −
                              <bpmndi:BPMNDiagram id="_18g2QGOeEeC-5r7T89MfkA">
                              −
                              <bpmndi:BPMNPlane id="_18g2QWOeEeC-5r7T89MfkA" bpmnElement="_18gPMGOeEeC-5r7T89MfkA">
                              −
                              <bpmndi:BPMNShape id="_18g2QmOeEeC-5r7T89MfkA" bpmnElement="_D469B734-5518-46B2-9AEB-C4D2ABFD4E9D">
                              <dc:Bounds height="30.0" width="30.0" x="385.0" y="183.0"/>
                              </bpmndi:BPMNShape>
                              −
                              <bpmndi:BPMNShape id="_18g2Q2OeEeC-5r7T89MfkA" bpmnElement="_50EEF545-CD3F-487B-BAA1-37DF671E1410">
                              <dc:Bounds height="80.0" width="100.0" x="460.0" y="158.0"/>
                              </bpmndi:BPMNShape>
                              −
                              <bpmndi:BPMNEdge id="_18g2RGOeEeC-5r7T89MfkA" bpmnElement="_4A5065B3-8B33-4B45-A2E0-0D4B589A0558">
                              <di:waypoint xsi:type="dc:Point" x="400.0" y="198.0"/>
                              <di:waypoint xsi:type="dc:Point" x="510.0" y="198.0"/>
                              </bpmndi:BPMNEdge>
                              −
                              <bpmndi:BPMNShape id="_18g2RWOeEeC-5r7T89MfkA" bpmnElement="_3716BA1C-AF84-4A46-9486-A98B758D2227">
                              <dc:Bounds height="28.0" width="28.0" x="604.0" y="183.0"/>
                              </bpmndi:BPMNShape>
                              −
                              <bpmndi:BPMNEdge id="_18g2RmOeEeC-5r7T89MfkA" bpmnElement="_EE09B72D-655B-4D1B-A831-25C7E393B4E0">
                              <di:waypoint xsi:type="dc:Point" x="510.0" y="198.0"/>
                              <di:waypoint xsi:type="dc:Point" x="618.0" y="197.0"/>
                              </bpmndi:BPMNEdge>
                              </bpmndi:BPMNPlane>
                              </bpmndi:BPMNDiagram>
                              </bpmn2:definitions>
                              
                              • 12. Re: Instantiating the KnowledgeBase
                                carek

                                I found the problem. I tried to debug the code to see what's going on and well there's a line of code which doesn't pass:

                                 

                                PackageRegistry pkgRegistry = this.packageBuilder.getPackageRegistry(process.getPackageName());
                                

                                 

                                and if pkgRegistry is null it throws this exception... In my case it is null because I don't know why but process.getPackageName() returns org.drools.bpmn2 and in packageRegistry there's defaultPackage package... Any assumptions why defaultPackage isn't returned?

                                • 13. Re: Instantiating the KnowledgeBase
                                  eaa

                                  Great! You finally found the problem. It seems that the process editor is not setting the process package by default. I mean, if you create a new process in pkgA, then the package of that process (in the definition) should be pkgA.

                                  Try to configure the package name using the editor. I don't remember if that is possible in the version you are using.

                                  If you want to do a quick test, just open your process with notepad using webdav and add tns:packageName="defaultPackage" into your <process> tag. jBPM compiler will look for that attribute and if it doesn't find it, it uses "org.drools.bpmn2".

                                   

                                  Best Regards,

                                  • 14. Re: Instantiating the KnowledgeBase
                                    carek

                                    ok thanks a lot for help and great amount of patience ... so now I just need to report a defect to oryx editor? hehe

                                     

                                    once again thanks a lot. Take care

                                    1 2 Previous Next