4 Replies Latest reply on Jun 29, 2009 6:29 AM by vignesh57

    Help needed in deploying 'par' to JBoss server

    vignesh57


      Hi folks, i am new to jBPM. I use to deploy projects using the deployment tab in eclicpse IDE. I now want to deploy it using java code.
      I tried the following piece of code. No exceptions & errors. But the file is not deployed. Please help me in completing this.



      JbpmContext ctx = JbpmConfiguration.getInstance().createJbpmContext();
       try {
       FileInputStream fis = new FileInputStream("c:\\test.par");
      
       ZipInputStream is = new ZipInputStream(fis);
      
       ProcessDefinition pd = ProcessDefinition.parseParZipInputStream(is);
      
       ctx.deployProcessDefinition(pd);
      
       ctx.getGraphSession().saveProcessDefinition(pd);
      
       System.out.println("Deployment Successfull");
       }
       catch(Exception e)
       {
       System.out.println(e.toString());
       }
       finally {
       ctx.close();
       }
      


        • 1. Re: Help needed in deploying 'par' to JBoss server
          kukeltje

          Sorry, but you provide way to little information for us to be helpful. My first reaction would be that the engine and your deploy code use two different databases.

          --
          He who asks within 5 minutes is a fool, he who never asks probably learned a lot himself

          • 2. Re: Help needed in deploying 'par' to JBoss server
            vignesh57

            Hi ronald,
            Thanks for the reply & the humorous quote !
            And F.Y.K.I, i am trying this for more than 2 days & also this is the first ever FORUMN POST in my life !!!
            And Sorry for giving less information. i am a newbie to jBPM and NOT a jBPM architect(like u).

            There are two ways i know of deploying a process definition.
            O Use the DEPLOYMENT tab while designing the jPDL in Eclipse IDE
            O Use the "Deploy Process" option in jBPM console, choose the par file & deploy it.
            Automating deployment....
            These are manual tasks. I am trying to automate it. I also saw Ant Scripts that deploy a par but i want to do it through java code.
            What i tried...
            What i posted previously is a stand-alone java code. I found that it is not able to connect to the jBPM database.
            -> While parsing the source file with parsePar, i got a classNotFound exception which i got rid of by importing the Java Transaction API(jta.jar) to Eclipse Build path.
            -> Now the Code runs successfully without any errors but the file is not deployed when i checked in jBPM console.
            -> I tried to get the list of process definitions. The size of List is found to be ZERO. This means that my code is not able to reach the jBPM hypersonic DB.

            I used these two methods.
            O ProcessDefinition.parseParZipInputStream
            O deployProcessDefinition

            What is the jBPM class that i should actually use ?
            Is there a jBPM community article that discuss this scenario ?
            How can i gain visiblity to the jBOSS deployment directory and connectivity to the jBPM database ?
            Do i need to specify somewhere, like the jBPM database used & server path in a config file ?

            My Enviroment:

            Server : JBoss 4.2.X
            jBPM : 3.X
            Database : Default db. (Hypersonic)

            Please ask me if you need any other information regarding this.

            • 3. Re: Help needed in deploying 'par' to JBoss server
              kukeltje

               


              -> Now the Code runs successfully without any errors but the file is not deployed when i checked in jBPM console.
              -> I tried to get the list of process definitions. The size of List is found to be ZERO. This means that my code is not able to reach the jBPM hypersonic DB.


              You try to retrieve the processdefinition list in the same application where you deploy the definition? If so, is that after the context is closed and reopened? If not, try this.

              I used these two methods.
              O ProcessDefinition.parseParZipInputStream
              O deployProcessDefinition

              What is the jBPM class that i should actually use ?

              These are fine, no problem.

              Is there a jBPM community article that discuss this scenario ?

              Not specifically, but all the jBPM unittests do it this way, but you are on the right track.

              How can i gain visiblity to the jBOSS deployment directory
              The JBoss deployment directory has nothing to do with deploying processdefinitions, at least not in jBPM 3


              and connectivity to the jBPM database ?

              Turn on the debug level of jBPM and hibernate to see if there is something going on


              Do i need to specify somewhere, like the jBPM database used & server path in a config file ?


              If this is from eclipse, yes, you have to configure this in the hibernate.cfg.xml file

              • 4. Re: Help needed in deploying 'par' to JBoss server
                vignesh57

                Hi Ronald, thanks for the help. I completed this task....
                What i did was a silly mistake that beginners used to do.

                O I wrote a stand-alone java code in which i added the attached code in main method itself :o
                O Then i realized how it will get Visiblity to the jBPM Database....
                O Moved the piece of code and embeded it to an ESB Service & it worked !!
                O Hope no other beginners does this mistake. This forumn should help them. at least.

                However, one strange thing i noticed.

                O Whenever we deploy, jBPM assigns a (auto-increment type) process definition id.
                O The id of the last app i deployed was 204.
                O But the id the latest deployment is 234.
                O So the strange fact is that, my 'dumb old code' actually inserted a record in the database BUT it ain't showed up in the jBPM Web Console :0
                [/img]