3 Replies Latest reply on Dec 1, 2005 8:25 AM by ch praveen

    Not getting latest Process definition

    ch praveen Newbie

      Hi All,

      I have created a par file that contains processdefinition.xml(say with name pdefTest1.xml), processimage.jsp and gpd.xml. I deployed it and able to create process instances on it. But when I updated processdefinition.xml (pdefTest1.xml) and redeployed that par file, it got loaded successfully in database but its not there in the list fetched by graphSession.findLatestProcessDefinitions() [getting old processdefinition id only] . Whenever I modified processdefinition, I need to give it a new name in <process-definition name="<new name>"> tag so as to obtain it from graphSession.findLatestProcessDefinitions(). Is there any workaround for this

      Thanks in advance

        • 1. Re: Not getting latest Process definition
          Ronald van Kuijk Master

          how do you deploy thisw new par file?

          • 2. Re: Not getting latest Process definition
            ch praveen Newbie

            Hi Kukeltje,

            My par file contains below contents::


            gpd.xml
            processdefinition.xml
            processimage.xml


            I have created a new process project using eclipse plugin, which created by default sample.par folder with above contents. Later I modified the processdefinition.xml file, adjusted the image [ as boxes are overlapped], checked whether processimage.jsp reflects my processdefinition or not. If everyting is fine then compressed sample.par folder and renamed it to testPdef1.par.

            Iam loading this par file through a jsp page
            <%@ page language="java" %>
            <%@ page import="org.jbpm.graph.def.*,org.jbpm.graph.exe.*,org.jbpm.taskmgmt.exe.*,com.sample.workflow.bean.*,java.util.*,org.jbpm.db.*,com.sample.workflow.context.*,java.io.*" %>
            
            <%
             UserBean objUserBean = (UserBean) session.getAttribute("userBean");
             if(objUserBean == null)
             {
            %>
             <jsp:forward page="demo1Login.jsp"/>
             <%
             }
            
             String processDefPARPath = request.getParameter("xmlPathProcessDef");
             if(processDefPARPath == null || processDefPARPath.trim().equals(""))
             {
             %>
            
             <center>Please select process definition path to continue .....
             <p><a href="demo1Home.jsp">Home</a></center>
            <%
             return;
             }
            %>
            
            <%
             // Get process definition
             ProcessDefinition processDefinition = null;
             try
             {
             processDefinition = ProcessDefinition.parseParResource(processDefPARPath);
             }
             catch(Exception fne)
             {
            %>
             <p><font color='red'>Error:: <%= fne.getMessage() %></font>
             <p><center>Failed to start process.
             <p><a href="demo1Home.jsp">Home</a></center>
            <%
             fne.printStackTrace();
             return;
             }
            
             // Save process definition in db.
             JbpmSession jbpmSession = Context.getPersistenceContext().getJbpmSession();
            
             GraphSession graphSession = jbpmSession.getGraphSession();
            
             graphSession.saveProcessDefinition(processDefinition);
            %>
            
             <center>Started process with Id, <b><%= processDefinition.getId() %></b> successfully
             <p><a href="demo1Home.jsp">Home</a></center>
            


            This way Iam able to store par file in database. Later I can get the processdefinitions with graphSession.getLatestProcessDefinitions() method.

            If I try to deploy another/modified processdefinition with the same name as that of already existing process definition[old one], its getting loaded successfuly. But while fetching process definition list[graphSession.getLatestProcessDefinitions()], instead of modified process definition, old process definition is fetched.


            • 3. Re: Not getting latest Process definition
              ch praveen Newbie

              Anyone can listout the situations where graphSession.findLatestProcessDefinitions() fails to fetch latest definitions. For a particular processdefinition Iam getting old version being listed instead of latest one.