[jBPM] - Is there anybody who know how to get a process variable's value when get a task by userid?
by 星兰 蒋
星兰 蒋 [https://community.jboss.org/people/jiang_hoo] created the discussion
"Is there anybody who know how to get a process variable's value when get a task by userid?"
To view the discussion, visit: https://community.jboss.org/message/779861#779861
--------------------------------------------------------------
Hi JBPM,
SOS!!!!
In my case,in fact i want to get the vars's value when i get a task by userid. And these values are passed when i start a processinstance.
i set & get values all in myself application. no using the jbpm console. Also no using marshall and unmarshall.
*Set values when start process:*
Map<String,Object> params = new HashMap<String,Object>();
params.put("sales", c.getCreateby());
params.put("contractno", c.getContractno());
params.put("details", c.getDetails());
params.put("amount", c.getAmount());
params.put(role.getRole(), leader.getName());
params.put("accoptor", list.get(0).getName());
getSession().startProcess(definitionId, params);
*Get values when get a task by userid:*
List<TaskSummary> t = sTaskService.getTasksAssignedAsTaskInitiator(idRef, "en-UK");
if(null != t && t.size() > 0){
for(TaskSummary ts : t){
Object obj = getTaskContentInput(ts);
Map<?, ?> map = (Map<?, ?>) obj;
for (Map.Entry<?, ?> entry : map.entrySet()) {
System.out.println(entry.getKey() + " = " + entry.getValue());
}
tasks.add(new TaskRef(ts.getId(), ts.getProcessInstanceId() + "", ts.getProcessId(),
ts.getName(), ts.getCreatedBy().getId(), ts.getStatus() == Status.Suspended, ts.getStatus() != Status.Suspended));
}
}
*And the getTaskContentInput method as blow:*
public Object getTaskContentInput(TaskSummary taskSum) {
BlockingGetTaskResponseHandler handlerT = new BlockingGetTaskResponseHandler();
client.getTask(taskSum.getId(), handlerT);
Task task2 = handlerT.getTask();
TaskData taskData = task2.getTaskData();
BlockingGetContentResponseHandler handlerC = new BlockingGetContentResponseHandler();
client.getContent(taskData.getDocumentContentId(), handlerC);
Content content = handlerC.getContent();
ByteArrayInputStream bais = new ByteArrayInputStream(
content.getContent());
try {
ObjectInputStream is = new ObjectInputStream(bais);
Object obj = null;
while ((obj = is.readObject()) != null) {
System.out.println("OBJECT: " + obj);
return obj;
}
} catch (Exception e) {
System.err.print("There was an error reading task input...");
e.printStackTrace();
return null;
}
return null;
}
*Is My way right or wrong? Would you pls give some advice?*
*Thanks and Best Regards!*
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/779861#779861]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM] - Transaction in JBPM
by Sam Mano
Sam Mano [https://community.jboss.org/people/artist123] created the discussion
"Transaction in JBPM"
To view the discussion, visit: https://community.jboss.org/message/780169#780169
--------------------------------------------------------------
h3. My scenario 1:
I have one persistence.xml with one persistence unit and describing both process table and task table persistence info in mysql db running locally.
Non XA datasource environment.
h5. Test 1:
Create some process flow using one human task node (using local human task) and run all in one flow.
h5. Result:
working fine , creating tables and updating data and close the process and session properly- success
h5. Test 2:
In the same above scenario,want to create human task service using mina as server to connect the taskservice and start the process separately to connect the human task using mina and complete the human task.
h5. Result:
It fails and throws transaction exception due to btm.
h6. My Investigation / Observation:
Since I am using one persistence unit to create the entitymanager, I am passing this entity manager to task service. what happen is first i am starting the human task service using mina ...it is working fine and starting the mina server. that time btm transaction journal log files open and locked. After starting the mina task server successfully I tried to start the process to complete the human task. what happen now is againg I am creating a entitymanger using the same persistence unit to create a knowledgesession, since the btm is already active and locked by the humantaskservice, this throws the "bitronix.tm.utils.InitializationException: cannot open disk journal".
h6. My question:
1- What I am tring to achive is correct or wrong?
2 - Do I need to treat the process and human task service separate components? if yes why? (I gone throug the documents still have doubts)?
3 - If I use JTA for human task and process persistence, how to handle? Do I need two persistence units? is it possible to have one persistence unit to handle this (do not want to use local human task want to use mina or hornetq)?
Note:
I created two separate persistence units one for task and one for process process unit using JTA and BTM, while task persistence unit not in this test working fine.
please join me to discuss this topics,
thanks in advance,
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/780169#780169]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM] - while i intergrate the spring tomcat mysql jbpm botronix, i meet this exception
by 星兰 蒋
星兰 蒋 [https://community.jboss.org/people/jiang_hoo] created the discussion
"while i intergrate the spring tomcat mysql jbpm botronix,i meet this exception"
To view the discussion, visit: https://community.jboss.org/message/780139#780139
--------------------------------------------------------------
05/12 22:16:16,767[main] ERROR tool.hbm2ddl.SchemaExport.execute - schema export unsuccessful
java.sql.SQLException: error enlisting a JdbcConnectionHandle of a JdbcPooledConnection from datasource jdbc/jbpm-ds in state ACCESSIBLE with usage count 1 wrapping a JDBC LrcXAConnection on mailto:com.mysql.jdbc.Connection@4e19b97c com.mysql.jdbc.Connection@4e19b97c on a JDBC LrcConnectionHandle on a JDBC LrcXAResource in state NO_TX
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:86)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.createStatement(JdbcConnectionHandle.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:63)
at $Proxy1.createStatement(Unknown Source)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:254)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:353)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: bitronix.tm.internal.BitronixSystemException: resource 'jdbc/jbpm-ds' cannot be used outside XA transaction scope. Set allowLocalTransactions to true if you want to allow this and you know your resource supports this.
at bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:79)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.enlistResource(JdbcConnectionHandle.java:84)
... 54 more
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/780139#780139]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM] - I got a NameNotFoundException when i want to createEntityManagerFactory , What's wrong?
by 星兰 蒋
星兰 蒋 [https://community.jboss.org/people/jiang_hoo] created the discussion
"I got a NameNotFoundException when i want to createEntityManagerFactory ,What's wrong?"
To view the discussion, visit: https://community.jboss.org/message/780066#780066
--------------------------------------------------------------
0 05/12 16:45:38,194[http-8080-2] ERROR hibernate.connection.DatasourceConnectionProvider.configure - Could not find datasource: jdbc/jbpm-ds
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:75)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at com.sogou.ka.jbpm.impl.CommandDelegate.newStatefulKnowledgeSession(CommandDelegate.java:54)
at com.sogou.ka.jbpm.impl.CommandDelegate.getSession(CommandDelegate.java:116)
at com.sogou.ka.jbpm.impl.CommandDelegate.getProcess(CommandDelegate.java:134)
at com.sogou.ka.jbpm.impl.ProcessManagementImpl.getProcessDefinition(ProcessManagementImpl.java:46)
at com.sogou.ka.service.impl.ContractServiceImpl.newContractService(ContractServiceImpl.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/780066#780066]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[JBoss Cache] - JBoss cache lock TimeoutException
by Andrew TR
Andrew TR [https://community.jboss.org/people/andrewtr] created the discussion
"JBoss cache lock TimeoutException"
To view the discussion, visit: https://community.jboss.org/message/780122#780122
--------------------------------------------------------------
We are running our application in JBoss 4.2.0 GA and Hibernate 3.x. Two JBoss application servers are running in cluster mode.
All of sudden we got this below exception and App server 1 (node1) went down:
2012-12-04 14:23:18,568 WARN org.jboss.web.tomcat.service.session.InstantSnapshotManager./et org.jboss.web.tomcat.service.session.InstantSnapshotManager./et Failed to replicate session BvlehVnGPW2uuH09kn+Prw**.node1
java.lang.RuntimeException: JBossCacheService: exception occurred in cache put after retry ...
at org.jboss.web.tomcat.service.session.JBossCacheWrapper.put(JBossCacheWrapper.java:153)
at org.jboss.web.tomcat.service.session.JBossCacheService.putSession(JBossCacheService.java:319)
at org.jboss.web.tomcat.service.session.JBossCacheClusteredSession.processSessionRepl(JBossCacheClusteredSession.java:121)
at org.jboss.web.tomcat.service.session.JBossCacheManager.processSessionRepl(JBossCacheManager.java:1097)
at org.jboss.web.tomcat.service.session.JBossCacheManager.storeSession(JBossCacheManager.java:652)
at org.jboss.web.tomcat.service.session.InstantSnapshotManager.snapshot(InstantSnapshotManager.java:49)
at org.jboss.web.tomcat.service.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:98)
at org.jboss.web.tomcat.service.session.JvmRouteValve.invoke(JvmRouteValve.java:84)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/JSESSION/localhost/et/BvlehVnGPW2uuH09kn+Prw**, caller=Thread[ajp-192.168.129.36-8009-15,5,jboss], lock=write owner=Thread[IncomingPacketHandler (channel=Tomcat-ETProd),5,JGroups threads] (activeReaders=0, activeWriter=Thread[IncomingPacketHandler (channel=Tomcat-ETProd),5,JGroups threads], waitingReaders=4, waitingWriters=0, waitingUpgrader=0)
at org.jboss.cache.Node.acquire(Node.java:500)
at org.jboss.cache.interceptors.PessimisticLockInterceptor.acquireNodeLock(PessimisticLockInterceptor.java:379)
at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:307)
at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:175)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.ReplicationInterceptor.invoke(ReplicationInterceptor.java:39)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:167)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5863)
at org.jboss.cache.TreeCache.put(TreeCache.java:3759)
at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy90.put(Unknown Source)
at org.jboss.web.tomcat.service.session.JBossCacheWrapper.put(JBossCacheWrapper.java:141)
... 17 more
Caused by: org.jboss.cache.lock.TimeoutException: write lock for /JSESSION/localhost/et/BvlehVnGPW2uuH09kn+Prw** could not be acquired after 15000 ms. Locks: Read lock owners: []
Write lock owner: Thread[IncomingPacketHandler (channel=Tomcat-ETProd),5,JGroups threads]
(caller=Thread[ajp-192.168.129.36-8009-15,5,jboss], lock info: write owner=Thread[IncomingPacketHandler (channel=Tomcat-ETProd),5,JGroups threads] (activeReaders=0, activeWriter=Thread[IncomingPacketHandler (channel=Tomcat-ETProd),5,JGroups threads], waitingReaders=4, waitingWriters=0, waitingUpgrader=0))
at org.jboss.cache.lock.IdentityLock.acquireWriteLock(IdentityLock.java:206)
at org.jboss.cache.Node.acquireWriteLock(Node.java:529)
at org.jboss.cache.Node.acquire(Node.java:476)
... 42 more
Also hereby attached the ejb3-clustered-sfsbcache-service.xml for configuration reference.
Appreciate any help.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/780122#780122]
Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months