[jBPM] - Trying to configure the Email service task in jBPM 5.4
by Andy McC
Andy McC [https://community.jboss.org/people/andymcc] created the discussion
"Trying to configure the Email service task in jBPM 5.4"
To view the discussion, visit: https://community.jboss.org/message/806520#806520
--------------------------------------------------------------
I'm trying to use the built-in Email service task and have been referring to https://community.jboss.org/message/793190#793190 for guidance.
However, probably because I'm a newbie, I'm having trouble getting it working and wondered if anyone could help me answer the following:
1. The above link provides an example of how to write a test case* Can anyone confirm that the code snippet available at the link should actually work? (I can't get it to work and have attached my bpmn and test code, although they are essentially the same as the link)
* If I wasn't defining a test case, how should I invoke the setConnection method?
* Do I add code to the "On Entry Action" of my Email activity, i.e. embed the setConnection call into the BPMN definition somehow?
* If so, can anyone offer some example code?
2. Part of the problem may be that I'm using a gmail account. Has anyone successfully set one of these up recently? (My account is new and I've obtained an application specific password for use with jBPM)
3. Newer versions of the jars used by the Email task are available (activation-1.1.jar, mail-1.4.jar). Should these be used instead?
4. Is the built-in Email service task essentially the same as the one provided by Kris V at http://people.redhat.com/kverlaen/repository/Email/? If so, should I be using that instead?
Many thanks,
Andy McC
PS The editor seems to have done random things with the fonts in the posting. Sorry.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806520#806520]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Re: getProcess in ProcessInstanceImpl throws a NullPointerException
by Sandra Renaud
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion
"Re: getProcess in ProcessInstanceImpl throws a NullPointerException"
To view the discussion, visit: https://community.jboss.org/message/806531#806531
--------------------------------------------------------------
Anyone to help please?
I don't succed to debug this.
This is the code of knowledgeSession producer :
log.debug("produce the KnowledgeSession ...");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
List<Resource> resources = getProcessDefinitionList();
for (Resource resource : resources) {
kbuilder.add(resource, ResourceType.BPMN2);
}
if ( kbuilder.hasErrors() ) {
log.error( kbuilder.getErrors().toString() );
}
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
if(kbase != null){
System.out.println("knowledge base NOT null");
for(org.drools.definition.process.Process p :kbase.getProcesses()){
System.out.println(" - process "+p.getName()+" ["+p.getId()+"]");
}
}
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
System.out.println(" !!!! DEBUG SESSION PERSISTENCE : new session with id : "+ksession.getId()+" !!!!");
And the associated log :
knowledge base NOT null
- process newcpbeforem29commontrunk [com.st.ams.flows.newcpbeforem29commontrunk]
- process newcpbeforem29 [com.st.ams.flows.newcpbeforem29]
- process newfinishedgood [com.st.ams.flows.newfinishedgood]
- process DataCorrections [com.st.ams.flows.datacorrections]
- process newproductline [com.st.ams.flows.newproductline]
Hibernate:
insert
into
SessionInfo
(lastModificationDate, rulesByteArray, startDate, OPTLOCK)
values
(?, ?, ?, ?)
!!!! DEBUG SESSION PERSISTENCE : new session with id : 32 !!!!
After that I try to retrieve all tasks and display task information. This use the method below :
public Object getProcessVariable(Long processInstanceId, Long taskId, String key){
Object retObj = null;
WorkflowProcessInstance wpi = (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
if((wpi == null) || (wpi.getVariable(key) == null)){
System.out.println("workflow process instance is null :-(");
}else{
System.out.println("workflow process instance is NOT null :-)");
retObj = wpi.getVariable(key);
//node info
System.out.println("is knowledge runtime null? "+(kSession.getSessionClock() == null));
System.out.println("list of node instance : ");
for(NodeInstance iNode : wpi.getNodeInstances()){
Node node = iNode.getNode();
}
}
return retObj;
}
and the associated log :
workflow process instance is NOT null :-)
is knowledge runtime null? false
list of node instance :
but then I have the same error as for my first post in the ProcessInstanceImpl class
Caused by: java.lang.NullPointerException
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getWorkflowProcess(WorkflowProcessInstanceImpl.java:181) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getNodeContainer(WorkflowProcessInstanceImpl.java:69) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:103) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]
at com.st.ams.task.management.TaskManager.getProcessVariable(TaskManager.java:234) [classes:]
It may be the kruntime that is null but how it is null?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806531#806531]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - Problem with multiple sessions
by Gareth Edwards
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion
"Problem with multiple sessions"
To view the discussion, visit: https://community.jboss.org/message/806522#806522
--------------------------------------------------------------
Hi,
I am one knowledge session per process.
Each knowledge session has one workItem handler, one humanTask handler and two processEventListener listeners.
The behavior I am seeing is that If I only have one process (in one session) then that can be completed fine and another process (and session) can be started etc.
If I have more than one session and complete one of the processes then the afterProcessCompleted event is called fine, at that point the other processes cannot be completed or at least the events do not fire.
I can see that I have a different sessionId for each session and no exceptions are being thrown. It’s as if disposing of a session is effecting the other sessions.
How are knowledge sessions normally managed?
I am creating knowledge sessions within an object and storing the object in an arraylist.
Help will be most appreciated.
JBPM5.4
JBoss 7.1
Cheers,
Gareth.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806522#806522]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - getProcess in ProcessInstanceImpl throws a NullPointerException
by Sandra Renaud
Sandra Renaud [https://community.jboss.org/people/joploya] created the discussion
"getProcess in ProcessInstanceImpl throws a NullPointerException"
To view the discussion, visit: https://community.jboss.org/message/806156#806156
--------------------------------------------------------------
Hello,
I have a NullPointerException when I set process variables and I don't know if it is normal.
The exception comes from this code of jbpm :
//In ProcessInstanceImpl
public Process getProcess() {
if (this.process == null) {
this.process = kruntime.getKnowledgeBase().getProcess(processId);
}
return this.process;
}
and this is the StackTrace :
SEVERE [javax.faces.event] (http--127.0.0.1-8080-2) java.lang.NullPointerException
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:68)
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getContextInstance(ProcessInstanceImpl.java:133)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setVariable(WorkflowProcessInstanceImpl.java:238)
at com.st.ams.task.management.TaskManager.setProcessVariable(TaskManager.java:234)
at com.st.ams.task.management.TaskManager$Proxy$_$$_WeldClientProxy.setProcessVariable(TaskManager$Proxy$_$$_WeldClientProxy.java)
at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstanceFgPlanStep2(NewFinishedGoodProcessManagement.java:149)
at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstancePlan(NewFinishedGoodProcessManagement.java:89)
at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement.manageInstance(NewFinishedGoodProcessManagement.java:71)
at com.st.ams.form.nfg.jbpm.process.NewFinishedGoodProcessManagement$Proxy$_$$_WeldClientProxy.manageInstance(NewFinishedGoodProcessManagement$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:564)
at org.jboss.weld.event.EventImpl.fire(EventImpl.java:68)
at com.st.ams.form.bean.EmailBean.send(EmailBean.java:148)
at com.st.ams.form.bean.EmailBean$Proxy$_$$_WeldClientProxy.send(EmailBean$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:153)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397)
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
at java.lang.Thread.run(Thread.java:722)
WARN [org.jboss.solder.exception.control.log] (http--127.0.0.1-8080-2) No handlers found for exception javax.faces.event.AbortProcessingException: java.lang.NullPointerException
I use persistent session and
WorkflowProcessInstance wpi = (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);
return a non null instance.
Regards,
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806156#806156]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months
[jBPM] - JTA issue when starting a process from another thread
by Gareth Edwards
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion
"JTA issue when starting a process from another thread"
To view the discussion, visit: https://community.jboss.org/message/806432#806432
--------------------------------------------------------------
Hello,
I have a queue of objects which contain all the information required to start a new process session.
Using Spring's @Scheduled annotation I'm periodically calling a method to poll the queue and start new workflows running.
The problem is because of the scheduling the method is called using another thread and the following error below occurs:
{code}
Caused by: java.lang.IllegalStateException: Unable to find transaction: java:comp/UserTransaction
at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:124) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:69) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:303) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:117) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
... 24 more
Caused by: javax.naming.NameNotFoundException: java:comp/UserTransaction
at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:121)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_10]
at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:119) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
... 27 more
{code}
I'm using jbpm 5.4 and JBoss 7.1
I have read that using java:jboss/TransactionManager instead can resolve this issue but java:comp/UserTransaction is hard coded in the drools-persistence-jpa jar.
Do I need to download the source and build another version of the jar?
There must be a simple work around for this.
Thanks in advance.
Gareth.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/806432#806432]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 2 months