[jboss-user] [JBoss jBPM] - Re: How to deploy a BPEL process using the APIs?
dhanushgopinath
do-not-reply at jboss.com
Thu Jul 10 01:07:03 EDT 2008
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163447#4163447
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163447
More information about the jboss-user
mailing list