0 Replies Latest reply on May 11, 2007 2:15 PM by s b

    error deploying by code

    s b Newbie

      I'm trying to deploy our ProcessDefinition by code rather than manually. We're getting an error but I don't know what it might mean:


      09:36:53,968 [Start EFile Destruct Workflow-admin] INFO JBPMAccessor : [JBPMAccessor.startEfileDestructionProcess] Did not find latest Process Definition of JBPMEfileProcess...
      09:36:53,968 [Start EFile Destruct Workflow-admin] INFO JBPMAccessor : [JBPMAccessor.startEfileDestructionProcess] This was the error: org.jbpm.JbpmException: couldn't find process definition 'JBPMEfileProcess'
      09:36:53,968 [Start EFile Destruct Workflow-admin] INFO JBPMAccessor : [JBPMAccessor.startEfileDestructionProcess] Attempting to deploy Process Definition of JBPMEfileProcess...
      09:36:53,968 [Start EFile Destruct Workflow-admin] INFO JBPMAccessor : Entering deployNewProcessDefinition
      09:36:53,968 [Start EFile Destruct Workflow-admin] DEBUG JbpmContextInfo : creating jbpm context with service factories '[message, tx, scheduler, authentication, persistence, logging]'
      09:36:53,968 [Start EFile Destruct Workflow-admin] DEBUG JbpmContext : creating org.jbpm.JbpmContext@16f4ce0
      09:36:53,968 [Start EFile Destruct Workflow-admin] INFO JBPMAccessor : Retrieved jbpmContext.
      09:36:54,031 [Start EFile Destruct Workflow-admin] WARN JpdlParser : couldn't set xml parser property property 'http://java.sun.com/xml/jaxp/properties/schemaLanguage' to 'http://www.w3.org/2001/XMLSchema'
      org.xml.sax.SAXNotRecognizedException: Property: http://java.sun.com/xml/jaxp/properties/schemaLanguage
      at org.apache.crimson.parser.XMLReaderImpl.setProperty(XMLReaderImpl.java:257)
      at org.apache.crimson.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:177)
      at org.jbpm.jpdl.xml.JpdlParser.createXmlReader(JpdlParser.java:77)
      at org.jbpm.jpdl.xml.JpdlParser.createSaxReader(JpdlParser.java:62)
      at org.jbpm.jpdl.xml.JpdlParser.parse(JpdlParser.java:56)
      at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:142)
      at org.jbpm.graph.def.ProcessDefinition.parseXmlReader(ProcessDefinition.java:181)
      at com.rco.bpm.util.JBPMAccessor.deployNewProcessDefinition(JBPMAccessor.java:327)
      at com.rco.bpm.util.JBPMAccessor.startEfileDestructionProcess(JBPMAccessor.java:71)
      at com.rco.jsp.CJobs2$CStartElectronicFileDestructionWorkflowJob.runJob(CJobs2.java:197)
      at com.rco.jsp.CJobControl$CJobThread.run(CJobControl.java:2246)


      The ap runs under Tomcat. We have another installation where we deployed the process definition manually and we do not have any problem with the jBPM engine. I'm wondering if I have some wrong or missing jar on my system. In case it helps, the code that creates this error is below:

       /**
       * Method to create a new JBPM process
       *
       * @param orgNumber The organization number for the new process
       * @param suborgNumber The suborg number for the new process
       * @return processID The unique ID of this newly created destruction task
       */
       public static long startEfileDestructionProcess(String orgNumber, String suborgNumber) throws RMSException{
       long processID = -1;
       log.info("Entering startEfileDestructionProcess");
      
       //Check if the jbpmConfiguration has been setup
       if( jbpmConfiguration == null ){
       //retrieve it
       log.info("JBPMConfiguration was null, creating instance.");
       jbpmConfiguration = JbpmConfiguration.getInstance();
       }
      
       //Doing a try and catch for all so the RMSException can contain the relevant info
       // Lookup the pojo persistence context-builder that is configured above
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       log.info("Retrieved jbpmContext.");
      
      
       try {
      
       // Make sure we're deployed.
       String strFilePath = "C:\\Documents and Settings\\All Users\\Documents\\RoyImage2000\\application\\webapps\\Image2000\\WEB-INF\\classes\\processdefinition.xml";
      
       try
       {
       log.info("[JBPMAccessor.startEfileDestructionProcess] Finding latest Process Definition of JBPMEfileProcess "
       + " in file: " + strFilePath);
       jbpmContext.getGraphSession().findLatestProcessDefinition("JBPMEfileProcess");
       log.info("[JBPMAccessor.startEfileDestructionProcess] Found latest Process Definition of JBPMEfileProcess");
       }
       catch (JbpmException je)
       {
       // Procession definition probably not deployed. Deploy it.
       log.info("[JBPMAccessor.startEfileDestructionProcess] Did not find latest Process Definition of JBPMEfileProcess...");
       log.info("[JBPMAccessor.startEfileDestructionProcess] This was the error: " + je.toString());
       log.info("[JBPMAccessor.startEfileDestructionProcess] Attempting to deploy Process Definition of JBPMEfileProcess...");
       deployNewProcessDefinition(strFilePath);
       log.info("[JBPMAccessor.startEfileDestructionProcess] After attempting to deploy Process Definition of JBPMEfileProcess...");
       }
      
       log.info("Creating process");
      
       //Create a new Process Instance of JBPMEfileProcess
       ProcessInstance processInstance = jbpmContext.newProcessInstance("JBPMEfileProcess");
       log.info("Created process");
       processID = processInstance.getId();
       log.info("ProcessID is ["+processID+"]");
      
       //Set the key variables
       processInstance.getContextInstance().createVariable("OrgNumber",orgNumber);
      
       log.info("Set Org Number");
       processInstance.getContextInstance().createVariable("SubOrgNumber",suborgNumber);
       log.info("Set SubOrg Number");
      
       // Now the processInstance is saved in the database. So the
       // current state of the execution of the process is stored in the
       // database.
       processInstance.signal();
       jbpmContext.save(processInstance);
       log.info("Saved New Process");
       }catch(Exception e){
       String message = "Error creating new RMS process["+e.getMessage()+"]";
       e.printStackTrace();
       throw new RMSException(1,message);
       }
       finally {
       // Tear down the pojo persistence context.
       jbpmContext.close();
       }
      
       log.info("Exiting startEfileDestructionProcess, created processID["+processID+"]");
       return processID;
       }
      
      /**
       * Method to deploy a new Process Definition, this method most likely will be removed
       * or otherwise protected
       * @param arg The full filepath of the new process definition to deploy
       */
       public static void deployNewProcessDefinition(String arg){
       log.info("Entering deployNewProcessDefinition");
      
       //Check if the jbpmConfiguration has been setup
       if( jbpmConfiguration == null ){
       //retrieve it
       log.info("JBPMConfiguration was null, creating instance.");
       jbpmConfiguration = JbpmConfiguration.getInstance();
       }
      
       //Doing a try and catch for all so the RMSException can contain the relevant info
       // Lookup the pojo persistence context-builder that is configured above
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       log.info("Retrieved jbpmContext.");
      
       if( arg == null || arg.length() == 0 ){
       log.error("File name must be specified, cannot deploy new process.");
       }
       else{
       try {
       FileReader fr = new FileReader(arg);
       ProcessDefinition newProcessDefinition = ProcessDefinition.parseXmlReader(fr);
       log.info("Deploying process");
      
       jbpmContext.deployProcessDefinition(newProcessDefinition);
      
       log.info("Deployed New ProcessDefinition");
       }catch(Exception e){
       e.printStackTrace();
       }
       finally {
       // Tear down the pojo persistence context.
       jbpmContext.close();
       }
       }
       log.info("Exiting deployNewProcessDefinition");
      
       }