[jbpm-users] [JBoss jBPM] - Deployment using PAR File

nizzy do-not-reply at jboss.com
Wed Jul 16 06:13:49 EDT 2008


Hi,

I'm trying to programmatically deploy a par file using JBPM 3.2.2 and JBoss 4.2.2.

I have written the following code

  | public void deployParFile(String fileName) throws Exception {
  |         if (log.isDebugEnabled()) {
  |             log.debug("inside deployParFile(fileName)");
  |         }
  |         
  |         JbpmContext ctx = JbpmConfiguration.getInstance().createJbpmContext();
  |         try {
  |             FileInputStream fis = new FileInputStream(fileName);
  |             ZipInputStream is = new ZipInputStream(fis);
  |             ProcessDefinition pd = ProcessDefinition.parseParZipInputStream(is);
  |             
  |             ctx.deployProcessDefinition(pd);
  |             ctx.getGraphSession().saveProcessDefinition(pd);
  |             
  |         } finally {
  |             ctx.close();
  |         }
  |         
  |     }

However I get the following error


  | javax.ejb.EJBException: org.jbpm.jpdl.JpdlException: [[ERROR] no processdefinition.xml inside process archive]
  | 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | Caused by: org.jbpm.jpdl.JpdlException: [[ERROR] no processdefinition.xml inside process archive]
  | 	at org.jbpm.jpdl.par.JpdlArchiveParser.readFromArchive(JpdlArchiveParser.java:43)
  | 	at org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:81)
  | 	at org.jbpm.graph.def.ProcessDefinition.parseParZipInputStream(ProcessDefinition.java:198)
  | 	at com.ecebs.core.processviewer.ui.service.JBPMConsoleManager.deployParFile(JBPMConsoleManager.java:212)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.deployParFile(Unknown Source)
  | 	at com.ecebs.test.MultipleProcessesTest.deployPar(MultipleProcessesTest.java:96)
  | 	at com.ecebs.test.MultipleProcessesTest.<init>(MultipleProcessesTest.java:73)
  | 	at com.ecebs.test.MultipleProcessesTest.main(MultipleProcessesTest.java:172)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.deployParFile(Unknown Source)
  | 	at com.ecebs.test.MultipleProcessesTest.deployPar(MultipleProcessesTest.java:96)
  | 	at com.ecebs.test.MultipleProcessesTest.<init>(MultipleProcessesTest.java:73)
  | 	at com.ecebs.test.MultipleProcessesTest.main(MultipleProcessesTest.java:172)

I'm passing in to my deployPar method the name of the par file to be deployed, this file is present in the bin directory of my JBoss installation.

1. Any ideas for the error, I know that the par file contains the processdefinition.xml?
2. Will using this deployment method enable me to dislay the processdefinition image or will I have to write other code to perform this?

I have previous deployed programmatically using the following code and it works however it would be much tidier if I could use the par file!

    public void deployProcessDefinitions(Collection<String> dirs) {
  |         // Get JBPM Context
  |         JbpmContext ctx = JbpmConfiguration.getInstance().createJbpmContext();
  |         try {
  |             for (String dir : dirs) {
  |                 
  |                 // each entry of dirs is of format [processdefintion.xml : processimage.jpg : gpd.xml ]
  |                 
  |                 log.info("Attempting to deploy [processdefintion.xml : processimage.jpg : gpd.xml ] from " + dir);
  |                 // Parse process definition
  |                 ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(dir + "/processdefinition.xml");
  |                 // Deploy
  |                 ctx.deployProcessDefinition(processDefinition);
  |                 ctx.getGraphSession().saveProcessDefinition(processDefinition);
  |                 
  |                 // Add processimage.jpg and gpd.xml
  |                 FileDefinition fd = processDefinition.getFileDefinition();
  |                 if (fd == null) {
  |                     fd = new FileDefinition();
  |                     processDefinition.addDefinition(fd);
  |                 }
  |                 
  |                 // Create InputStream from fileName
  |                 FileInputStream fis = new FileInputStream(dir + "/processimage.jpg");
  |                 fd.addFile("processimage.jpg", fis);
  |                 ctx.getGraphSession().saveProcessDefinition(processDefinition);
  |                 
  |                 fis = new FileInputStream(dir + "/gpd.xml");
  |                 fd.addFile("gpd.xml", fis);
  |                 ctx.getGraphSession().saveProcessDefinition(processDefinition);
  |                 
  |                 log.info("Successfully deployed [processdefintion.xml : processimage.jpg : gpd.xml ] from " + dir);
  |             }
  |         } catch (Exception e) {
  |             e.printStackTrace();
  |         } finally {
  |             ctx.close();
  |         }

Thanks for continued support!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164698#4164698

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164698



More information about the jbpm-users mailing list