1 2 Previous Next 24 Replies Latest reply on Sep 5, 2008 5:35 AM by francis17101970

    How to deploy a BPEL process using the APIs?

    dhanushgopinath

      Hi,

      I am using JBPM BPEL Engine on my JBOSS and I want to deploy my process using an external application rather than using the web browser. Is it possible to deploy a BPEL process using JBPM BPEL API's ? If so what API's should one use? Is there any documentation for it?

      I am using jbpm-bpel-1.1.GA

      Many Thanks
      Dhanush

        • 1. Re: How to deploy a BPEL process using the APIs?
          dhanushgopinath

          Hi

          Any updated on this? Or is this the wrong forum.

          Thanks

          • 2. Re: How to deploy a BPEL process using the APIs?

            you can find in bpel1.1ga/samples/common/bpel.xml

            bpel use httpclient to deploy


            More detail I am researching now.

            • 3. Re: How to deploy a BPEL process using the APIs?

              in server side,bpel use a deploymentservlet to handle httpclient http post(not support get method)which contain a processarchive file ,and use jbpm deploy to deploy the processarchive .

              • 4. Re: How to deploy a BPEL process using the APIs?

                So,I think,we can use JbpmContext deployment the process.

                • 5. Re: How to deploy a BPEL process using the APIs?

                  after deploy the processdefination,you should call org.jbpm.bpel.tools.WebModuleBuilder to build war module,and deploy it.

                  Now I understand why after deploy there are no *.zip file in deploy dir and why there are many .war file.

                  can some one give more detail or advice?
                  Especially the bpel team.
                  thanks a lot.

                  • 6. Re: How to deploy a BPEL process using the APIs?
                    dhanushgopinath

                    Thanks jsports. I am looking into what you said. The only problem I see is there is not documentation on this exposed. Do you have any ?

                    Thanks
                    Dhanush

                    • 7. Re: How to deploy a BPEL process using the APIs?

                      I have made a mistake.
                      The following is right.
                      jbpm-bpel-1.1.GA\examples\common\bpel-build.xml.

                      deploy.process---->deploymentservlet--->jbpm processdefination deploy-->webmodulebuilder

                      • 8. Re: How to deploy a BPEL process using the APIs?
                        arkenchoust

                        hi jsports, thx for your posts below,

                        I'm in the same situation as dhanushgopinath, and i wanna know if there is a tutorial or a kind of step by step tutorial on deploying BPEL process on jBOSS AS.

                        i've followed the official tutorial on the jboss web site, and some of other tutorials on the net (thx to google :P) but nothing did work for a moment xD

                        • 9. Re: How to deploy a BPEL process using the APIs?
                          arkenchoust

                          getting the error below :



                          [deployprocess] java.net.SocketException: Connection reset
                          [deployprocess] at java.net.SocketInputStream.read(SocketInputStream.jav
                          a:168)
                          [deployprocess] at java.io.BufferedInputStream.fill(BufferedInputStream.
                          java:218)
                          [deployprocess] at java.io.BufferedInputStream.read(BufferedInputStream.
                          java:237)
                          [deployprocess] at org.apache.commons.httpclient.HttpParser.readRawLine(
                          HttpParser.java:77)
                          [deployprocess] at org.apache.commons.httpclient.HttpParser.readLine(Htt
                          pParser.java:105)
                          [deployprocess] at org.apache.commons.httpclient.HttpConnection.readLine
                          (HttpConnection.java:1115)
                          [deployprocess] at org.apache.commons.httpclient.HttpMethodBase.readStat
                          usLine(HttpMethodBase.java:1832)
                          [deployprocess] at org.apache.commons.httpclient.HttpMethodBase.readResp
                          onse(HttpMethodBase.java:1590)
                          [deployprocess] at org.apache.commons.httpclient.HttpMethodBase.execute(
                          HttpMethodBase.java:995)
                          [deployprocess] at org.apache.commons.httpclient.HttpMethodDirector.exec
                          uteWithRetry(HttpMethodDirector.java:397)
                          [deployprocess] at org.apache.commons.httpclient.HttpMethodDirector.exec
                          uteMethod(HttpMethodDirector.java:170)
                          [deployprocess] at org.apache.commons.httpclient.HttpClient.executeMetho
                          d(HttpClient.java:396)
                          [deployprocess] at org.apache.commons.httpclient.HttpClient.executeMetho
                          d(HttpClient.java:324)
                          [deployprocess] at org.jbpm.bpel.tools.ant.DeploymentTask.execute(Deploy
                          mentTask.java:61)
                          [deployprocess] at org.apache.tools.ant.UnknownElement.execute(UnknownEl
                          ement.java:288)
                          [deployprocess] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown S
                          ource)
                          [deployprocess] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg
                          atingMethodAccessorImpl.java:25)
                          [deployprocess] at java.lang.reflect.Method.invoke(Method.java:597)
                          [deployprocess] at org.apache.tools.ant.dispatch.DispatchUtils.execute(D
                          ispatchUtils.java:105)
                          [deployprocess] at org.apache.tools.ant.Task.perform(Task.java:348)
                          [deployprocess] at org.apache.tools.ant.Target.execute(Target.java:357)
                          [deployprocess] at org.apache.tools.ant.Target.performTasks(Target.java:
                          385)
                          [deployprocess] at org.apache.tools.ant.Project.executeSortedTargets(Pro
                          ject.java:1329)
                          [deployprocess] at org.apache.tools.ant.Project.executeTarget(Project.ja
                          va:1298)
                          [deployprocess] at org.apache.tools.ant.helper.DefaultExecutor.executeTa
                          rgets(DefaultExecutor.java:41)
                          [deployprocess] at org.apache.tools.ant.Project.executeTargets(Project.j
                          ava:1181)
                          [deployprocess] at org.apache.tools.ant.Main.runBuild(Main.java:698)
                          [deployprocess] at org.apache.tools.ant.Main.startAnt(Main.java:199)
                          [deployprocess] at org.apache.tools.ant.launch.Launcher.run(Launcher.jav
                          a:257)
                          [deployprocess] at org.apache.tools.ant.launch.Launcher.main(Launcher.ja
                          va:104)

                          BUILD FAILED
                          C:\sensus\BPELConfig\common\bpel-build.xml:61: connection to deployment service
                          failed


                          • 10. Re: How to deploy a BPEL process using the APIs?
                            dhanushgopinath

                            I guess it is not able to connect to your server

                            • 11. Re: How to deploy a BPEL process using the APIs?
                              dhanushgopinath

                              HI,

                              I tried doing the same thing jsports mentioned.. and I was successful to some extend. Some logs came :).

                              But I hit upon this error. Anyone have any idea?

                              2:41:57,494 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.PortTypeImpl
                              12:41:57,494 DEBUG [Configuration] resolving reference to class: org.jbpm.bpel.wsdl.impl.OutputImpl
                              12:41:57,494 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.MessageImpl
                              12:41:57,494 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.OperationImpl
                              12:41:57,494 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.MessageImpl
                              12:41:57,494 DEBUG [Configuration] resolving reference to class: org.jbpm.bpel.graph.def.ImportDefinition
                              12:41:57,635 INFO [NamingHelper] JNDI InitialContext properties:{}
                              12:41:58,135 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/DefaultDS
                              javax.naming.NameNotFoundException: jbpmbpel-client not bound
                               at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                               at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                               at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                              


                              Thanks
                              Dhanush

                              • 12. Re: How to deploy a BPEL process using the APIs?

                                you should read example/hello

                                there is some file you should provide

                                especially the jndi name:jbpmbpel-clinet.

                                You can find the file in hello dir.

                                • 13. Re: How to deploy a BPEL process using the APIs?
                                  aguizar

                                  To deploy programmatically, use the following code:

                                  public void deployProcessDefinition(String fileName) {
                                   ProcessDefinition processDefinition = readProcessDefinition(
                                   new FileInputStream(fileName), fileName);
                                   deployProcessDefinition(processDefinition);
                                   // build and deploy web module, if the language is BPEL
                                   if (processDefinition instanceof BpelProcessDefinition)
                                   deployWebModule((BpelProcessDefinition) processDefinition, fileName);
                                  }

                                  The file name is expected to reference a process archive. The support methods are presented below.
                                  private ProcessDefinition readProcessDefinition(InputStream fileSource, String fileName)
                                   throws IOException {
                                   try {
                                   ProcessArchive processArchive = new ProcessArchive(new ZipInputStream(fileSource));
                                   log.debug("loaded process archive: " + fileName);
                                  
                                   ProcessDefinition processDefinition = processArchive.parseProcessDefinition();
                                   log.debug("read process definition: " + processDefinition.getName());
                                  
                                   return processDefinition;
                                   }
                                   finally {
                                   fileSource.close();
                                   }
                                   }
                                  
                                   private void deployProcessDefinition(ProcessDefinition processDefinition) {
                                   JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                                   try {
                                   if (processDefinition instanceof BpelProcessDefinition) {
                                   BpelGraphSession graphSession = BpelGraphSession.getContextInstance(jbpmContext);
                                   graphSession.deployProcessDefinition((BpelProcessDefinition) processDefinition);
                                   }
                                   else
                                   jbpmContext.deployProcessDefinition(processDefinition);
                                   log.info("deployed process definition: " + processDefinition.getName());
                                   }
                                   catch (RuntimeException e) {
                                   jbpmContext.setRollbackOnly();
                                   throw e;
                                   }
                                   finally {
                                   jbpmContext.close();
                                   }
                                   }
                                  
                                   private void deployWebModule(BpelProcessDefinition processDefinition, String fileName) {
                                   File moduleFile = new File(deployDirectory, extractFilePrefix(fileName) + ".war");
                                  
                                   WebModuleBuilder builder = new WebModuleBuilder();
                                   builder.setModuleFile(moduleFile);
                                   builder.buildModule(processDefinition);
                                  
                                   if (builder.getProblemHandler().getProblemCount() > 0)
                                   throw new BpelException("could not build web module for: " + processDefinition);
                                  
                                   log.info("deployed web module: " + moduleFile.getName());
                                   }
                                  
                                   private static String extractFilePrefix(String fileName) {
                                   int dotIndex = fileName.lastIndexOf('.');
                                   return dotIndex != -1 ? fileName.substring(0, dotIndex) : fileName;
                                   }
                                  }

                                  In method deployWebModule, the variable deployDirectory references the app server's deploy directory. Inside JBoss, this directory can be retrieved from the system properties as follows.
                                  String deployDirectory = System.getProperty("jboss.server.home.dir") + File.separatorChar + "deploy";

                                  The above snippets were adapted from class DeploymentServlet; you can review its source in our online repository.

                                  • 14. Re: How to deploy a BPEL process using the APIs?
                                    dhanushgopinath

                                    Hi Alex,

                                    Many thanks for giving the code. But in fact I have already followed the same code base to come up with my own standalone application. the code is as given.

                                    public class DeployProcess {
                                    
                                     public static void main(String[] args)
                                     {
                                     String fileName = "E:\\WorkFlowProjects\\JBoss-BPEL-Deployments\\Workflow3\\src\\Workflow3.zip";
                                    
                                     DeployProcess deployObj = new DeployProcess();
                                     deployObj.InitDeployDirectory();
                                     try {
                                     deployObj.Deploy(fileName,args);
                                     } catch (Exception e) {
                                     // TODO Auto-generated catch block
                                     e.printStackTrace();
                                     }
                                    
                                    
                                    
                                     }
                                    
                                     private void InitDeployDirectory() {
                                     String deployDirectoryName = null;
                                     // deduce the deploy directory from environment information
                                     String serverHomeDirectory;
                                     try {
                                     serverHomeDirectory = "D:\\JBOSS\\jboss-4.2.0.GA";
                                     }
                                     catch (SecurityException e) {
                                     serverHomeDirectory = null;
                                     }
                                     deployDirectoryName = serverHomeDirectory + File.separatorChar + "deploy";
                                     deployDirectory = new File(deployDirectoryName);
                                    
                                     }
                                    
                                     private File deployDirectory = null;
                                    
                                     private void Deploy(String fileName, String[] args) throws Exception {
                                     String xmlResource =args[0]; //"D:\\JBOSS\\jbpm-bpel-1.1.GA\\config\\jbpm.cfg.xml";
                                     JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(xmlResource);
                                     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                                     FileInputStream fisProcess = new FileInputStream(fileName);
                                     ProcessArchive processArchive = new ProcessArchive(new ZipInputStream(fisProcess));
                                     ProcessDefinition processDefinition = processArchive.parseProcessDefinition();
                                    
                                    
                                     if (processDefinition instanceof BpelProcessDefinition)
                                     {
                                     BpelGraphSession graphSession = BpelGraphSession.getContextInstance(jbpmContext);
                                     graphSession.deployProcessDefinition((BpelProcessDefinition) processDefinition);
                                     }
                                     else
                                     jbpmContext.deployProcessDefinition(processDefinition);
                                     if (processDefinition instanceof BpelProcessDefinition)
                                     deployWebModule((BpelProcessDefinition) processDefinition, fileName);
                                     }
                                    
                                     private void deployWebModule(BpelProcessDefinition processDefinition,
                                     String fileName) {
                                     File moduleFile = new File(deployDirectory, extractFilePrefix(fileName) + ".war");
                                    
                                     WebModuleBuilder builder = new WebModuleBuilder();
                                     builder.setModuleFile(moduleFile);
                                     builder.buildModule(processDefinition);
                                    
                                    
                                     }
                                    
                                     private static String extractFilePrefix(String fileName) {
                                     int dotIndex = fileName.lastIndexOf('.');
                                     return dotIndex != -1 ? fileName.substring(0, dotIndex) : fileName;
                                     }
                                    }
                                    
                                    


                                    But when the statement

                                    BpelGraphSession graphSession = BpelGraphSession.getContextInstance(jbpmContext);


                                    is getting executed I get the following exception;


                                    0:26:35,402 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.MessageImpl
                                    10:26:35,402 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.OperationImpl
                                    10:26:35,402 DEBUG [Configuration] resolving reference to class: com.ibm.wsdl.MessageImpl
                                    10:26:35,402 DEBUG [Configuration] resolving reference to class: org.jbpm.bpel.graph.def.ImportDefinition
                                    10:26:35,683 INFO [NamingHelper] JNDI InitialContext properties:{}
                                    10:26:37,513 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/DefaultDS
                                    javax.naming.NameNotFoundException: jbpmbpel-client not bound
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                                     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                                     at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                     at java.lang.reflect.Method.invoke(Method.java:585)
                                     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
                                     at sun.rmi.transport.Transport$1.run(Transport.java:153)
                                     at java.security.AccessController.doPrivileged(Native Method)
                                     at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
                                     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
                                     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
                                     at java.lang.Thread.run(Thread.java:595)
                                     at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                                     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                                     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
                                     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
                                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                     at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:129)
                                     at $Proxy0.lookup(Unknown Source)
                                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                     at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
                                     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
                                     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
                                     at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
                                     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
                                     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
                                     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
                                     at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
                                     at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
                                     at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
                                     at org.jbpm.bpel.persistence.db.DbPersistenceService.getBpelGraphSession(DbPersistenceService.java:56)
                                     at org.jbpm.bpel.persistence.db.BpelGraphSession.getContextInstance(BpelGraphSession.java:124)
                                     at DeployProcess.Deploy(DeployProcess.java:64)
                                     at DeployProcess.main(DeployProcess.java:25)
                                    org.hibernate.HibernateException: Could not find datasource
                                     at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
                                     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
                                     at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
                                     at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:410)
                                     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
                                     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
                                     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
                                     at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
                                     at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:95)
                                     at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:99)
                                     at org.jbpm.bpel.persistence.db.DbPersistenceService.getBpelGraphSession(DbPersistenceService.java:56)
                                     at org.jbpm.bpel.persistence.db.BpelGraphSession.getContextInstance(BpelGraphSession.java:124)
                                     at DeployProcess.Deploy(DeployProcess.java:64)
                                     at DeployProcess.main(DeployProcess.java:25)
                                    Caused by: javax.naming.NameNotFoundException: jbpmbpel-client not bound
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                                     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                                     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                                     at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                     at java.lang.reflect.Method.invoke(Method.java:585)
                                     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
                                     at sun.rmi.transport.Transport$1.run(Transport.java:153)
                                     at java.security.AccessController.doPrivileged(Native Method)
                                     at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
                                     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
                                     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
                                     at java.lang.Thread.run(Thread.java:595)
                                     at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                                     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                                     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
                                     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
                                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
                                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                     at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:129)
                                     at $Proxy0.lookup(Unknown Source)
                                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                     at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
                                     ... 13 more
                                    


                                    This is the problem I am facing with now.

                                    Is it necessary that the Deploying App always be a Web App?

                                    Please let me know.

                                    Thanks
                                    Dhanush

                                    1 2 Previous Next