[JBoss jBPM] - does this design make sense?
by twiceknightly
My app is set up as a stateless session bean calling jbpm. So within the enerprise bean I open the hibernate session, do my jbpm goodness and then save and close the hibernate session.
I have a process definition with multiple tokens each signalling on different part of the process graph. The child tokens live for the life of the process i.e. there is no join.
I was thinking that to stop classic concurrency problems like lost update problem I thought I might be able to use a special task for the purpose of locking i.e. use it as a lock. I could put something in the ejb, so before it performs the signal on one of the tokens (or whatever) , it has to acquire the lock (special task) for this process.
Do you think this makes sense?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163338#4163338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163338
17 years, 9 months
[JBoss jBPM] - Re: How to deploy a BPEL process using the APIs?
by alex.guizar@jboss.com
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163241#4163241
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163241
17 years, 9 months
[JBoss jBPM] - Need steps to deploy BPEL in MySQL
by Music123
Hi,
I am new to JBPM. I need to create a sample web application using JBPM workflow.
Sample application needs to be created in both jPdl and BPEL languages with MySQL as database.I configured jPdl with MySQL.
Problem in jPdl:
I tried to deploy a processdefinition.xml file from servlet. If i am giving the processdefinition file as string then its working fine.
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition name='the baby process'>" +
" <start-state>" +
" " +
" </start-state>" +
" <task-node name='t'>" +
" " +
" " +
" " +
" " +
" </task-node>" +
" <end-state name='end' />" +
"</process-definition>"
);
if i try to deploy using "ProcessDefinition.parseXmlResource()" as shown below
ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("processdefinition.xml");
Its giving me the following error:
org.jbpm.jpdl.JpdlException: [[ERROR] couldn't parse process definition]
org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:172)
org.jbpm.graph.def.ProcessDefinition.parseXmlInputStream(ProcessDefinition.java:180)
org.jbpm.graph.def.ProcessDefinition.parseXmlResource(ProcessDefinition.java:161)
simpleTest.FirstServlet.deployProcessDefinition(FirstServlet.java:145)
simpleTest.FirstServlet.service(FirstServlet.java:79)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
I am struggling to configure BPEL with MySQL.
Problem in BPEL:
Could you please let me know the steps to configure BPEL with MySQL and how to create tables for BPEL?
I am getting the following error in JBOSS server:
javax.naming.NameNotFoundException: XAConnectionFactory 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 org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:182)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:188)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:510)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl$ExceptionListenerRunnable.run(JMSContainerInvoker.java:1428)
at java.lang.Thread.run(Thread.java:619)
If anybody have sample web application using JBPM, please send me that too.
Please help me out to solve these issues. Thanks in Advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163180#4163180
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163180
17 years, 9 months