1 2 3 Previous Next 31 Replies Latest reply on Jul 7, 2014 1:39 AM by swiderski.maciej Go to original post
      • 15. Re: jBPM 6 Deploy a process from Java code
        swiderski.maciej

        what you could try to do is to once you pushed your changes, exit kie-config-cli and then start it again and check deployments if the new one you added is still there. If it is there are two possibilities why it was not deployed to the actual runtime:

        - deployment actually failed due to some reasons like could not find the artifact in maven, etc

        - listener that is responsible for reacting on events on the git repository is not working, restart of the server then should make it appear in the runtime.

         

        Could you validate above and see if anything of this is anywhere close?

         

        HTH

        • 16. Re: jBPM 6 Deploy a process from Java code
          zen1800

          I tried exiting and starting it up again and the deployments are still there. are they supposed to disappear if it is successful?

           

          I have the artifact in the artifact repository page, but I don't see any errors in the server.log. I actually don't see any reference at all to the deployment I am trying.

           

          Restarting the server also does not seem to help. Still no deployments or log messages.

          • 17. Re: jBPM 6 Deploy a process from Java code
            criss_zz

            Hello All,

            I have some other problem but also connected with deploying process from Java code. In our application we have a singleton on EJB which provides RuntimeEngine instance.

            I would like to have a possibility to deploy process (from the application interface) on existing KieBase: runtimeEngine.getKieSession().getKieBase() during application runtime. Our application provides its own workflow editor and processes are stored in a data base. If user modifies the process is stored in the database and should be immediately placed to the current KieBase.

             

            During the start of the application, all process definitions are loaded from the database,  KieBase is created, runtimeEngine is initialized. And I would not want to do it again each time I deploy a new process.

             

            In jbpm 5.4 I do sth like this:

            KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

            kbuilder.add(ResourceFactory.newByteArrayResource(newDefinition),ResourceType.BPMN2);

            kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); 

             

            How should I do this in JBPM 6?

             

            Thank you in advance for your help.

            • 18. Re: jBPM 6 Deploy a process from Java code
              swiderski.maciej

              you can do pretty much the same way, but in that case you need to pass exactly same instance of kbase to the RuntimeEnvironment that is used to create RuntimeManager. Once you have an active runtime manager yo can add processes to the kbase and they should be visible for ksessions, especially for per process instance and per request strategies. And that should do the trick.

               

              HTH

              • 19. Re: jBPM 6 Deploy a process from Java code
                criss_zz

                Thank you Maciek. You have opened my eyes. Before I could not find a method "addKnowledgePackages" in KieBase interface. After your post I noticed that when I call getKieBase() on KieSession I got KnowledgeBaseImpl and this has addKnowledgePackages method. I have used this and now everything works well.

                 

                Just add that we use the singleton strategy while creating runtimeManager.

                • 20. Re: jBPM 6 Deploy a process from Java code
                  zen1800

                  - listener that is responsible for reacting on events on the git repository is not working, restart of the server then should make it appear in the runtime.

                    So is there away to check if the listener is working?

                  • 21. Re: jBPM 6 Deploy a process from Java code
                    zen1800

                    OK, so I was able to get the process to appear in the Deployments window after restarting the jBPM service. This would seem to indicate by your previous response that there is an issue with a listener for the git repository. Which leads me back to my last post on if there is a way to check the listener status? Restarting the server every time we want to deploy a new process is not ideal.

                    • 22. Re: jBPM 6 Deploy a process from Java code
                      swiderski.maciej

                      listener is enabled by default and can be disabled with system property org.uberfire.sys.repo.monitor.disabled, but I guess you haven't disabled it...

                       

                      you could enable debug logs for org.uberfire.backend.server.deployment on your jboss to see if it kick in. There is watcher service on git repository that is responsible for emitting an event whenever new things came to the repository and then the listener should get it and process it.

                      Just in case you would like to debug it or analyze the code here is listener class and here is the watcher service on the repo and here is the emitter of the events.

                       

                      HTH

                      • 23. Re: jBPM 6 Deploy a process from Java code
                        zen1800

                        Can see the listener (DeploymentConfigServiceImpl) get loaded into WELD, and I can see the emitter (ConfigurationServiceImpl) get loaded into WELD also, but I don't see any entry for the watcher (AbstractWatchService). The closest things I find are IOWatchServiceAllImpl and IOWatchServiceNonDotImpl. Are these the specific implementations for that class, or am I missing something?

                        • 24. Re: jBPM 6 Deploy a process from Java code
                          swiderski.maciej

                          correct, these two are subclasses of the AbstractWatchService.

                           

                          HTH

                          • 25. Re: jBPM 6 Deploy a process from Java code
                            zen1800

                            So, while it looks like all the pieces are getting loaded, somewhere one of them is either not firing an event or not catching it. I noticed that the DeployConfigServiceImpl has an updateRegisteredDeployments that seems to be getting called when jBPM starts up, which I would guess is why restarting the service gets the process fully deployed. Is there a way to explicitly call this method, or fire the SystemRepositoryChangedEvent that it is observing in order to kick it off?

                            • 26. Re: jBPM 6 Deploy a process from Java code
                              buenavida

                              Hallo Krzysztof!

                               

                              Do you have stored the binary data of your process definitions in your own database table?

                              How do you intialize your KnowledgeBuilder? Just by fetching every row of your process definitons table und add the binary ressource to the KnowlegeBuilder?

                               

                              Thanks for your answer,

                              Andi

                              • 27. Re: jBPM 6 Deploy a process from Java code
                                criss_zz

                                Hi Andreas, yes, we do it exactly as you described. Currently we have about 10 definitions of processes in several different versions. In total, about 50 definitions of processes. During startup applications all definitions are loaded to the RuntimeEnvironmentBuilder. In the future, the number of processes can be increased to about 1000. I do not know how it will behave then, maybe we will need to change the approach for this issue.  For example load only the highest version of processes on startup and the rest of defiinitions load on demand or something like that.

                                • 28. Re: jBPM 6 Deploy a process from Java code
                                  aha001

                                  Hi Maciej,

                                   

                                  (1)

                                  • build the kie-config-cli project successfully
                                  • unzip kie-config-cli-6.2.0-SNAPSHOT-dist.zip from kie-config-cli/target folder
                                  • run kie-config-cli.sh list but get this error

                                   

                                  org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [LuceneConfig] with qualifiers [@Named] at injection point [[parameter 1] of [constructor] @Inject public org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl(LuceneConfig, Instance<NamedQuery>)]

                                   

                                  All jar file was added to CLASSPATH correctly.

                                  Can you please advise if I have done something incorrectly?

                                   

                                  (2)

                                  Also if I have package sitting in local repository .m2/repository/com/jbpm/account/1.0/account-1.0.jar (kjar ready)

                                   

                                  if I want to deploy this to the jbpm, what is the command for this?

                                   

                                  Your help will be much appreciated.

                                  • 29. Re: jBPM 6 Deploy a process from Java code
                                    swiderski.maciej

                                    master (6.2.0-SNAPSHOT) is currently under heavy refactoring of UberFire extensions so it might not be stable at the moment. Especially that there is a known issue with ssh git integration that currently does not work. I would suggest to switch to 6.1.x branch which is stable and will become 6.1.0.Final. 6.2.0-SNAPSHOT is far away from being ready and it's meant for development only at the moment.

                                     

                                    for deploying kjars use add-deployment, for all available options use help to see all commands with short description.

                                     

                                    HTH