Re: [jboss-user] [jBPM] - Cancel a process throws exceptions
by Al Nadein
Al Nadein [http://community.jboss.org/people/matrixpooh] replied to the discussion
"Cancel a process throws exceptions"
To view the discussion, visit: http://community.jboss.org/message/558639#558639
--------------------------------------------------------------
package workflow;
import java.util.HashMap;
import java.util.Map;
import junit.framework.Assert;
import org.jbpm.api.Configuration;
import org.jbpm.api.Execution;
import org.jbpm.api.ExecutionService;
import org.jbpm.api.IdentityService;
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OpenProcessWithinProcessTest {
private static final Logger log = LoggerFactory.getLogger(OpenProcessWithinProcessTest.class);
public IdentityService identityService ;
public ExecutionService executionService;
public RepositoryService repositoryService;
static final String XML_MAIN = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
"\r\n" +
"<process key=\"main\" name=\"main\" xmlns=\"http://jbpm.org/4.4/jpdl\">\r\n" +
" \r\n" +
" <start g=\"228,13,48,48\" name=\"start\">\r\n" +
" <transition g=\"-73,-9\" name=\"to-Open Case\" to=\"Open Case\"/>\r\n" +
" </start>\r\n" +
" \r\n" +
" <foreach g=\"230,288,48,48\" in=\"#{events}\" name=\"foreach\" var=\"event\">\r\n" +
" <transition to=\"Create a sub-process\"/>\r\n" +
" </foreach>\r\n" +
" \r\n" +
" <custom class=\"com.gs.crd.requestmanager.workflow.mainprocess.OpenCase\" g=\"192,98,126,52\" name=\"Open Case\">\r\n" +
" <transition g=\"-58,-12\" name=\"to-case-termination-fork\" to=\"fork1\"/>\r\n" +
" </custom>\r\n" +
" <join g=\"230,462,48,48\" multiplicity=\"#{quorum + 1}\" name=\"join\">\r\n" +
" <transition g=\"-38,-14\" name=\"to-end\" to=\"end\"/>\r\n" +
" </join>\r\n" +
" <end g=\"232,628,48,48\" name=\"end\"/>\r\n" +
" \r\n" +
" <sub-process g=\"193,371,124,52\" name=\"Create a sub-process\" sub-process-key=\"#{event.name}\">\r\n" +
" <parameter-in expr=\"#{event.id}\" subvar=\"actionlistid\"/>\r\n" +
" <transition g=\"-35,-18\" name=\"to-join\" to=\"join\"/>\r\n" +
" </sub-process>\r\n" +
" <fork g=\"230,194,48,48\" name=\"fork1\">\r\n" +
" <transition g=\"-23,-16\" name=\"to foreach\" to=\"foreach\"/>\r\n" +
" <transition g=\"-67,-8\" name=\"to Wait for Case Termination\" to=\"Wait for Case Termination\"/>\r\n" +
" \r\n" +
" </fork>\r\n" +
" <state g=\"466,358,155,52\" name=\"Wait for Case Termination\">\r\n" +
" <transition g=\"-24,-2\" name=\"to join\" to=\"join\"/>\r\n" +
" </state>\r\n" +
" \r\n" +
"</process>";
static final String XML_SUB = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
"\r\n" +
"<process description=\"Create Accounts\" key=\"subprocess\" name=\"subprocess\" xmlns=\"http://jbpm.org/4.4/jpdl\">\r\n" +
" <start g=\"10,48,48,48\" name=\"start\">\r\n" +
" <transition g=\"-20,-17\" name=\"to task1\" to=\"task1\"/>\r\n" +
" </start>\r\n" +
" \r\n" +
" <end g=\"530,50,48,48\" name=\"end\"/>\r\n" +
" \r\n" +
" <task g=\"120,48,116,52\" name=\"task1\">\r\n" +
" <assignment-handler class=\"com.gs.crd.requestmanager.workflow.DummyTaskAssignmentHandler\"/>" +
" <transition g=\"-44,-18\" name=\"from-task1\" to=\"task2\"/>\r\n" +
" </task>\r\n" +
" \r\n" +
" <task g=\"336,48,114,52\" name=\"task2\">\r\n" +
" <transition g=\"-36,-18\" name=\"from-task2\" to=\"end\"/>\r\n" +
" </task>\r\n" +
" \r\n" +
"</process>";
String deploymentId;
ProcessEngine processEngine;
@Before
public void setUp() throws Exception {
// RequestManagerServicesInitializer.initWorkflowServiceForTests();
processEngine = new Configuration().setResource("jbpm.test.cfg.xml").buildProcessEngine();
identityService = processEngine.getIdentityService();
executionService = processEngine.getExecutionService();
repositoryService = processEngine.getRepositoryService();
identityService.createUser("jd", "jd", "jd");
identityService.createGroup("dummy");
identityService.createMembership("jd", "dummy", "role");
deploymentId = repositoryService.createDeployment().addResourceFromString("main.jpdl.xml", XML_MAIN)
.addResourceFromString("sub.jpdl.xml", XML_SUB).deploy();
}
@After public void tearDown() throws Exception {
// identityService.deleteUser("johndoe");
// identityService.deleteGroup("group");
// repositoryService.deleteDeploymentCascade(deploymentId);
}
@Ignore
public void testDefault() throws Exception {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("main");
Assert.assertNotNull(processInstance.getId());
}
@Test
public void testCancelBusinessProcess(){
SubprocessInputValues[] events = new SubprocessInputValues[] {
new SubprocessInputValues("subprocess", 134),
new SubprocessInputValues("subprocess", 134)};
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("events", events);
variables.put("quorum", new Integer(events.length));
final ProcessInstance processInstance = executionService.startProcessInstanceByKey("main", variables);
String processInstanceId = processInstance.getId();
final ProcessInstance processInstance1 = executionService.createProcessInstanceQuery().processInstanceId(processInstanceId).uniqueResult();;
// ((ActivityExecution)processInstance).end(Execution.STATE_ENDED);
processEngine.execute(new Command<Void>(){
@Override
public Void execute(Environment environment) throws Exception {
((ActivityExecution)processInstance1).end(Execution.STATE_ENDED);
return null;
}});
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558639#558639]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[jBPM] - Cancel a process throws exceptions
by Al Nadein
Al Nadein [http://community.jboss.org/people/matrixpooh] created the discussion
"Cancel a process throws exceptions"
To view the discussion, visit: http://community.jboss.org/message/558638#558638
--------------------------------------------------------------
Hi,
In my application, I'd like to be able to delete open (pending) process instances. My process instances usually consists of 2-8 subprocesses. The delete of the parent should be able to cascade delete its forked executions and its sub-processes, their forked children and their subprocesses. I'm running into
org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.pvm.internal.model.ExecutionImpl#23]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2559)
when doing a cascade delete. Seems that the process attempts to delete the parent record immediately, without looking for children processes.
Below is the complete unit test to reproduce the issue:
Your input would be highly appreciated.
package workflow;import java.util.HashMap;import java.util.Map;import junit.framework.Assert;import org.jbpm.api.Configuration;import org.jbpm.api.Execution;import org.jbpm.api.ExecutionService;import org.jbpm.api.IdentityService;import org.jbpm.api.ProcessEngine;import org.jbpm.api.ProcessInstance;import org.jbpm.api.RepositoryService;import org.jbpm.api.activity.ActivityExecution;import org.jbpm.api.cmd.Command;import org.jbpm.api.cmd.Environment;import org.junit.After;import org.junit.Before;import org.junit.Ignore;import org.junit.Test;import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class OpenProcessWithinProcessTest { private static final Logger log = LoggerFactory.getLogger(OpenProcessWithinProcessTest.class); public IdentityService identityService ; public ExecutionService executionService; public RepositoryService repositoryService; static final String XML_MAIN = "(){ @Override public Void execute(Environment environment) throws Exception { ((ActivityExecution)processInstance1).end(Execution.STATE_ENDED); return null; }}); }}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558638#558638]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[Beginner's Corner] - javax.naming.NoInitialContextException: Cannot instantiate class
by Noelia Delgado
Noelia Delgado [http://community.jboss.org/people/Zoeley] created the discussion
"javax.naming.NoInitialContextException: Cannot instantiate class"
To view the discussion, visit: http://community.jboss.org/message/558637#558637
--------------------------------------------------------------
Hi, I have a problem when I want to run my application's jar, it's a standalone app and I don't have this problem when I run it into Eclipse.
I'm using Jboss 5.1.0GA, maven 2.2.1 and JDK 1.6.18.
PS C:\Workspace\hre\target> java -jar AppClient.jar
java.exe : javax.naming.NoInitialContextException: Cannot instantiate class: or
g.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoun
dException: org.jnp.interfaces.NamingContextFactory]
At line:1 char:5
+ java <<<< -jar AppClient.jar
+ CategoryInfo : NotSpecified: (javax.naming.No...ContextFactory]
:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at util.Contexto.<init>(Contexto.java:22)
at mesa_entrada.IdPaciente.setContexto(IdPaciente.java:1627)
at mesa_entrada.IdPaciente.<init>(IdPaciente.java:185)
at principal.Escritorio$2.actionPerformed(Escritorio.java:206)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2
318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.ja
va:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonList
ener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6263)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.
java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.jav
a:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFa
ctory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:4
6)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 32 more
This is my code:
public Contexto() throws NamingException{
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty(Context.SECURITY_CREDENTIALS, "");
env.setProperty(Context.SECURITY_PRINCIPAL, "");
env.setProperty(Context.SECURITY_PROTOCOL, "java:/jaas/App");
this.ctx = new InitialContext(env);
}
I added my server.log
If anyone can help me I would appreciate it.
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558637#558637]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
Re: [jboss-user] [jBPM] - Deployments and the Console
by Karoy Labs
Karoy Labs [http://community.jboss.org/people/obolabs] replied to the discussion
"Deployments and the Console"
To view the discussion, visit: http://community.jboss.org/message/558627#558627
--------------------------------------------------------------
Ok, so I redid the whole thing, after wiping out the whole jbpm 4.4 environment. Kept the jboss and eclipse download zip to cut down a bit on the setup duration. After all this, the examples.bar is listed in Runtime.Deployments, as well the Processes tab shows all processes. Better.
Next, the deployment of my test process, using JbpmDeployTask, completed successfully as before. The ant output shows the deployer talking to HSQL and doing its thing, but I still can't see it in the jBPM console.
So, again, something happened, but not sure what. What's supposed to happen after/during a deployment? I think something was added to the database, but how does that get listed in the jBPM console?
Thanks again!
karoy
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558627#558627]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months
[JBoss Tools] - Including ESB Actions
by Robert Brown III
Robert Brown III [http://community.jboss.org/people/factor3] created the discussion
"Including ESB Actions"
To view the discussion, visit: http://community.jboss.org/message/558581#558581
--------------------------------------------------------------
I have created a new action for JBoss ESB using the ESB editor in JBoss Tools. This action is a custom action that has some fairly important functions that I am expecting that others in my development team will want to use. This action is designed for reuse; its functionality can be configured using a set of properties, some of which are mandatory but others are not.
Is it possible for someone to create a custom action, then be able to "install" that action back into the Tools? I'd like to be able to have it appear in one of the submenus that pops up when you click on the "Add" button for Actions. The idea is that others in the development team would be able to easily call up this action from within the IDE.
Is there a mechanism for doing this? If there is, can someone tell me how to use it?
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/558581#558581]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 10 months