[JBoss jBPM] - Re: does this design make sense?
by twiceknightly
"kukeltje" wrote : a special task, one special variable, one.... you name it.... The issue that you have to act on this special task in one way or another (when does concurrency end? what if this lock stays by accident, what do you return to the other token). Sound like your trying to invent a mechanism that maybe should be in the engine...
Yes but the special task is shared. Two threads would race to acquire the special task (read lock) but ultimately a task is stored in the database so wouldn't the concurrency end when accessing a row in the task instance table? It seems to me as if there should be a mechanism in the engine to lock a process when there are multiple tokens.
There may need to be a timer on the task to release it if it doesn't get released automatically or something.
dOoMi. I would really appreciate it if you could write a paragraph on your understanding of the situation. I'm not deeply into Hibernate and have a really tight deadline for this stuff.
To be fair I'm not familiar enough with jbpm yet to know at what level I need to provide synchronization. I presume it would be at the processInstance level.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163492#4163492
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163492
17 years, 9 months
[JBoss jBPM] - Re: does this design make sense?
by dOoMi
I'm facing the same problem: jBPM swallows the StaleObjectStateException causing the calling code not to notice that the operation failed.
I figured out a workaround, but I'm not sure yet, whether it's proper or not. The idea is to do the hibernate-commit() by myself and so be able to receive the StaleObjectStateException in case there was a concurrent update on the process-instance. In this case a retry can be scheduled.
| ProcessInstance pi = jbpmContext.loadProcessInstanceForUpdate(id);
|
| pi.signal("someTransitionIfYouWant");
|
| boolean error = false;
|
| try {
| // commit() on hibernate-level
| jbpmContext.getSession().getTransaction().commit();
|
| } catch (StaleObjectStateException e) {
| error = true;
|
| } finally {
| // the tricky part: on the close()-method the jbpmContext tries to commit(), again!
| // to avoid irritating error-messages, we need to make the jbpmContext NOT try to commit()
| DbPersistenceService dbps =
| (DbPersistenceService) jbpmContext.getServices().getPersistenceService();
|
| // this can be achieved by pretending that transactions are disabled anyway
| dbps.setTransactionEnabled(false);
| jbpmContext.getServices().setPersistenceService(dbps);
|
| // close jbpmContext
| jbpmContext.close();
| }
|
| // handle error if present
| if(error){
| // e.g. schedule retry
| }
| else{
| ...
| }
|
What do you guys think? Any suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163464#4163464
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163464
17 years, 9 months
[JBoss jBPM] - Re: How to deploy a BPEL process using the APIs?
by 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
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
17 years, 9 months
[JBoss jBPM] - Variable
by jorjao
Hi. I'm new developer in JBPM.
I have a question.
I have a process-state and would like to send n parameters. How is that I can indicate the value of these parameters?
<process-state name="controlo_documentos">
| <sub-process name="controlo_documentos"></sub-process>
| <variable access="read,write,required" name="form"></variable>
| <variable access="read,write,required" name="grupo_elaborantes"></variable>
| <variable access="read,write,required" name="grupo_verificacao"></variable>
| <variable access="read,write,required" name="grupo_aprovacao"></variable>
| <variable access="read,write,required" name="grupo_publicacao"></variable>
| <variable access="read,write,required" name="grupo_detentores"></variable>
|
| <transition to="join1"></transition>
| </process-state>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163356#4163356
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163356
17 years, 9 months