[jBPM] - How can I get a itemDefinition related to a process variable?
by Francesco Pietrobelli
Francesco Pietrobelli [http://community.jboss.org/people/francesco.pietrobelli] created the discussion
"How can I get a itemDefinition related to a process variable?"
To view the discussion, visit: http://community.jboss.org/message/620413#620413
--------------------------------------------------------------
Hi guys,
I would like to build forms for human activities in an automatic and dynamic fashion, but to do this I need to know the data type associated to every dataOutput of the tasks.
My first idea was to retrieve the data type of a process variable inside a WorkItemHandler in the following way:
public void executeWorkItem(WorkItem item, WorkItemManager manager) {
WorkflowProcessInstance currentProcess = (WorkflowProcessInstance) ksession.getProcessInstance(item.getProcessInstanceId());
HumanTaskNodeInstance currentNode = (HumanTaskNodeInstance) findNodeInstance(item.getId(), currentProcess);
Map<String, String> outMappings = ht.getHumanTaskNode().getOutMappings();
for (String outParameterName : outMappings.keySet()) {
System.out.println("Type of process variable: "+currentProcess.getVariable(outMappings.get(outParameterName)).getClass());
}
}
private WorkItemNodeInstance findNodeInstance(long workItemId,NodeInstanceContainer container) {
for (NodeInstance nodeInstance : container.getNodeInstances()) {
if (nodeInstance instanceof WorkItemNodeInstance) {
WorkItemNodeInstance workItemNodeInstance = (WorkItemNodeInstance) nodeInstance;
if (workItemNodeInstance.getWorkItem().getId() == workItemId) {
return workItemNodeInstance;
}
}
if (nodeInstance instanceof NodeInstanceContainer) {
WorkItemNodeInstance result = findNodeInstance(workItemId,((NodeInstanceContainer) nodeInstance));
if (result != null) {
return result;
}
}
}
return null;
}
But in many case outMappings.get(outParameterName) returns null because process variable wasn't set before and so and i can't invoke getClass() on it.
Does any one have any suggestion? is possible to do this programmatically via API?
Francesco.
P.S: I'am using jBPM 5.1Final
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/620413#620413]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[EJB3] - Re: Failed to acquire the pool semaphore in empty pool
by Garry Dias
Garry Dias [http://community.jboss.org/people/garrydias] created the discussion
"Re: Failed to acquire the pool semaphore in empty pool"
To view the discussion, visit: http://community.jboss.org/message/625559#625559
--------------------------------------------------------------
Let me explain better...
It´s my stateless bean:
@Clustered
@Stateless(name = "MyWorkerBean")
@Pool(value = PoolDefaults.POOL_IMPLEMENTATION_STRICTMAX, maxSize = 30)
public class MyWorkerBean implements WorkerInterface {
public void sleep(boolean flag) throws Exception
{
Thread.sleep(60000);
}
}
To stress this bean, I´m using a JMeter test case with 100 concurrent threads. Each thread perform a ejb lookUp for MyWorkerBean.
Each instance looked up performs a call to sleep() method. So, the first 30 lookups will perform and 70 will "Fail to aquire pool semaphore, strictTimeout=-1".
Now, I have 30 bean instances filling the pool for 60 seconds and the MBean for MyWorkerBean in jmx-console marks AvailableCount as 30.
After 60 seconds all 30 instances perform succesfully and I run 100 more jmeter threads, but this time all lookups blows with "Fail to aquire pool semaphore, strictTimeout=-1" and the MBean for MyWorkerBean in jmx-console marks AvailableCount as 0.
PS: the look up is performed by:
org.springframework.beans.factory.BeanFactory.getBean("MyWorkerBean")
h5.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625559#625559]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[EJB3] - Adding @Schedule annotation using AOP is not working
by Eman Emanovic
Eman Emanovic [http://community.jboss.org/people/emanovic] created the discussion
"Adding @Schedule annotation using AOP is not working"
To view the discussion, visit: http://community.jboss.org/message/625459#625459
--------------------------------------------------------------
Hi,
I already asked this question on AOP forum ( http://community.jboss.org/message/623183#623183 http://community.jboss.org/message/623183#623183). But I am not sure if it is AOP or EJB problem, so I copy it here as well.
I am trying to create schedule event using EJB3.1 @Schedule annotation. Everything works fine as long as I have the annotation inside my bean. I want to be able to change schedule in deployment time without repacking ear. So I want to add this annotation using AOP. But it doesn't work.
Here is my sample bean:
@AspectDomain(value = "TimerBeanDomain")
@Singleton
*public* *class* TimerBean {
*public* *void* timerMethod() {
System.out.println("Timer method activated");
}
}
And here is my aop.xml:
<?xml version="1.0" encoding="UTF-8"?>
<aop xmlns="urn:jboss:aop-beans:1.0">
<domain name="TimerBeanDomain">
<annotation expr="method(void *->timerMethod(..))>
@javax.ejb.Schedule(second=*/30, minute=*, hour=*")
</annotation>
</domain>
</aop>
Bean is packed inside -ejb.jar, which is packed in .ear. AOP file is outside ear file.
There are no errors in console. It just does not work.
I tried it with stateless bean as well. In this case aop.xml looked like:
<domain name="TimerBeanDomain" extends="Stateless Bean" inheritBindings="true">
I tried JBoss 6.0.1 and JBoss 6.1.0 with same result.
At least is there some way how to debug AOP process of adding annotation?
Any help will be appreciated.
Regards,
Eman
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625459#625459]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[jBPM] - Problem terminating a process
by Antonio De Berardis
Antonio De Berardis [http://community.jboss.org/people/antoniodb83] created the discussion
"Problem terminating a process"
To view the discussion, visit: http://community.jboss.org/message/625300#625300
--------------------------------------------------------------
Hi,
I have a process with some Human Tasks and some Java Service Task.
For the Human Tasks I registered the WorkItemHandler like this:
CommandBasedWSHumanTaskHandler wsh2= new CommandBasedWSHumanTaskHandler(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", wsh2);
while for my Service Task, I have implemented my handler:
public class JavaWorkItemHandler implements WorkItemHandler {
@Override
public void executeWorkItem(WorkItem workItem, WorkItemManager arg1) {
//do something
Map<String, Object> result=new HashMap<String, Object>();
arg1.completeWorkItem(workItem.getId(), result);
}
@Override
public void abortWorkItem(WorkItem arg0, WorkItemManager arg1) {
arg1.abortWorkItem(arg0.getId());
}
}
and registered it:
ksession.getWorkItemManager().registerWorkItemHandler("JavaNode", new JavaWorkItemHandler());
the process looks like this:
http://community.jboss.org/servlet/JiveServlet/showImage/2-625300-16957/p... http://community.jboss.org/servlet/JiveServlet/downloadImage/2-625300-169...
If I'm in the first Human Task and I send from outside an Event to terminate the process, I have:
org.jbpm.task.service.PermissionDeniedException: User '[User:'Administrator']' was unable to execution operation 'Skip' on task id 1 due to no 'current status' matchines
at org.jbpm.task.service.TaskServiceSession.evalCommand(TaskServiceSession.java:232)
at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:344)
at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:84)
at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:176)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
then the process will continue with the execution of the java task and the second Human Task.
Can anybody help me?
Thank you.
Antonio
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625300#625300]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months
[jBPM] - obsolete id
by Darryl Youngblood
Darryl Youngblood [http://community.jboss.org/people/d.y.] created the discussion
"obsolete id"
To view the discussion, visit: http://community.jboss.org/message/625248#625248
--------------------------------------------------------------
Greetings,
i get a Nullpointer exception due to an obsolete workitem id. I created a process with the eclipse bpmn2 process editor so the ids of the tasks are automatically incremented. then i deleted some tasks and replaced them. so in my case the task with id 10 got deleted and replaced with a task with the id 34. but when i start my process and it comes to my custom task and custom task handler i get 10 as the id instead of 34
public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
this.workItemId = wi.getId(); // ==10 instead of 34
this.wi = wi; // wi.name is also wrong
this.workItemManager = wim;
I could run my process when i used ((RuleFlowProcess) process).getNode(*34*).getOutgoingConnections().values() instead of
((RuleFlowProcess) process).getNode(*workItemId*).getOutgoingConnections().values()
but that is not a satisfying solution ;-) Is this bug known or do you have any advices how to solve this issue?
I'm using jbpm 5.1
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/625248#625248]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 3 months