[jBPM] - Sharing database between multiple JBPM runtimes
by baecks
baecks [http://community.jboss.org/people/baecks] created the discussion
"Sharing database between multiple JBPM runtimes"
To view the discussion, visit: http://community.jboss.org/message/610492#610492
--------------------------------------------------------------
Hello,
I have JBPM 3 deployed in a number of JBOSS AS 5.1. I set up the application server and JBPM to use one single MYSQL database for persistence (--> only one shared database). The idea is to use the database as a "synchronization mechanism" between the various JBPM instances. I'm now trying to find out if this is supported by JBPM 3 (& Hibernate) and whether the following use-cases will work:
1/ New ProcessDefinition
- Create a new ProcessDefinition on one server and store it into the database.
- On a second server, obtain the list of ProcessDefinitions using the JBPM API (GraphSession::findAllProcessDefinitions).
Will the new ProcessDefinition be in the list?
2/ Resume process instance
- On one server, start a new process instance and store the state into the database
- On a second server, retrieve the process instance (based on instance ID) and make the process continue (signal)
Is this possible?
The idea is to have multiple JBPM run-times "virtually" working together without a need for JBOSS AS clustering, Hibernate caches etc. I believe Hibernate does some caching (don't know exactly how) and I fear this might cause this setup not to work (completely). Any info on this would also be welcome.
All answers & help are very appreciated.
Thanks,
Sven.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/610492#610492]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 10 months
[EJB3] - Caused by: java.lang.IllegalStateException: Container jboss.j2ee:ear=are-1.0.ear, jar=product-ejb-1.0.jar, name=, service=EJB3, VMID=028fb87ee1d704b1:6cb36823:13096ff4b4f:-7ffd + is already registered
by Niraj Adhikary
Niraj Adhikary [http://community.jboss.org/people/nirajmind] created the discussion
"Caused by: java.lang.IllegalStateException: Container jboss.j2ee:ear=are-1.0.ear,jar=product-ejb-1.0.jar,name=,service=EJB3,VMID=028fb87ee1d704b1:6cb36823:13096ff4b4f:-7ffd + is already registered"
To view the discussion, visit: http://community.jboss.org/message/610473#610473
--------------------------------------------------------------
Hi All,
I am getting this issue while deploying in jboss 5.1 .
Any help is appriciated.
Thanks,
Niraj :((
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/610473#610473]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 10 months
[jBPM] - java.lang.IllegalArgumentException: attempt to create merge event with null entity
by Xiaojun Hou
Xiaojun Hou [http://community.jboss.org/people/houxiaojun] created the discussion
"java.lang.IllegalArgumentException: attempt to create merge event with null entity"
To view the discussion, visit: http://community.jboss.org/message/610453#610453
--------------------------------------------------------------
In my project,i use the code below to configure the persistence:
try {
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS");
ds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "root");
ds.getDriverProperties().put("password", "root");
ds.getDriverProperties().put("URL", "jdbc:mysql://localhost:3306/jbpm5");
ds.init();
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
// start a new process instance
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("org.jbpm.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,
emf);
env.set(EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager());
// create a new knowledge session that uses JPA to store the runtime
// state
StatefulKnowledgeSession ksession=null;
ksession= JPAKnowledgeService.newStatefulKnowledgeSession(
kbase,
null,
env);
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());
// start a new process instance
Map<String, Object> params = new HashMap<String, Object>();
params.put("employee", "krisv");
ksession.startProcess("com.sample.evaluation",params);
logger.dispose();
} catch (Throwable t) {
t.printStackTrace();
}
However,when i start a new processinstance and try to complete the first task,exception happens just like this:
Registered human task listener
[2011:06:167 10:06:520:debug] Message receieved on client : AddTaskResponse
[2011:06:167 10:06:520:debug] Arguments : [1]
[2011:06:167 10:06:324:debug] Message receieved on client : EventTriggerResponse
[2011:06:167 10:06:324:debug] Arguments : [org.jbpm.task.event.EventPayload@b98a06]
Task completed 1
[2011:06:167 10:06:609:debug] Message receieved on client : GetTaskResponse
[2011:06:167 10:06:609:debug] Arguments : [org.jbpm.task.Task@2a7159ce]
[2011:06:167 10:06:610:exception] Uncaught exception on client
java.lang.IllegalArgumentException: attempt to create merge event with null entity
at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:60)
at org.hibernate.event.MergeEvent.<init>(MergeEvent.java:43)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692)
at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:235)
at org.drools.persistence.jpa.JpaPersistenceContext.merge(JpaPersistenceContext.java:49)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:136)
at org.jbpm.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:249)
at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81)
at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)
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.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$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
after the exception,the task stored in the database has a "completed" status,Can somebody help me to solve the problem?
By the way,If i run the code above twice,exception will also happen just like this:
javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.sample.ProcessTest.main(ProcessTest.java:71)
Caused by: org.hibernate.HibernateException: Could not obtain BTM transaction manager instance
at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:357)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
... 8 more
Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal
at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:59)
at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:43)
... 13 more
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at java.io.RandomAccessFile.read(Native Method)
at java.io.RandomAccessFile.readInt(RandomAccessFile.java:720)
at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:77)
at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:50)
at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:132)
at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:46)
... 14 more
Hope someone can help me out here!!!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/610453#610453]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 10 months