[jBPM] - Instantiating workflow from EJB deployed as part of .ear : javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.secureall] Unable to build EntityManagerFactory
by Chaitanya Desai
Chaitanya Desai [http://community.jboss.org/people/chaitanya1987] created the discussion
"Instantiating workflow from EJB deployed as part of .ear : javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.secureall] Unable to build EntityManagerFactory"
To view the discussion, visit: http://community.jboss.org/message/619510#619510
--------------------------------------------------------------
I am trying to instantiate a process instance based on a process definition for JBPM 5.1 from a EJB deployed in the JBoss application server. The EJB is part of a .ear file , using the MySQL database.
I have defined a persistence unit in persistence.xml within the META-INF folder and also placed the corresponding JBPMorm.xml in the META-INF folder. The datasaource is deployed in the deploy folder of JBOss 5.1
persistence .xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="SecureALLPU" transaction-type="JTA">
<jta-data-source>java:/SecureAll</jta-data-source>
<properties>
<property name="hibernate.format_sql" value="true"/>
<property name="dialect" value="org.hibernate.dialect.OracleDialect"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
</properties>
</persistence-unit>
<persistence-unit name="org.jbpm.persistence.jpa.secureall" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jdbc/SecureAlljbpmDatasource</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="false" />
<!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> -->
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
JBPMORM.XML
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>
</entity-mappings>
Datasource:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/SecureAlljbpmDatasource</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/JBPM?useUnicode=true&characterEncoding=UTF-8</connection-url>
<!--<connection-url>jdbc:h2:mem:mydb</connection-url>-->
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
When i deploy my .ear file
App Server is able to recognise the datasource, persistence unit for jbpm datasource from persistence.xml and corresponding jbpmorm.xml.
However I get the exception : javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.secureall] Unable to build EntityManagerFactory
On looking into the details for it I understand that EntityManagerFactory needs to be loaded by the name: org.jbpm.persistence.jpa.secureall
Something like:
|
|
| EntityManagerFactory emf = |
|
|
| Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa.secureall" ); |
|
|
| Environment env = KnowledgeBaseFactory.newEnvironment(); |
|
|
| env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); |
|
|
| env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); |
However I am not sure how do i define EntityManagerFactory by that name such that it gets loaded by that name during deployment rather than during run time.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619510#619510]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[IronJacamar] - maven dependency setup.
by amber jboss1999
amber jboss1999 [http://community.jboss.org/people/amberjboss1999] created the discussion
"maven dependency setup."
To view the discussion, visit: http://community.jboss.org/message/618677#618677
--------------------------------------------------------------
I really fairly new to JCA development so maybe I am just not looking in the right places; so I want to apologize if the questions is too fundamental. But with what little example I've found from the 1.0.6-Beta distribution/samples, it wasn't very helpful for me to determine all the dependencies(and version) I need to compile a project.
The example just asked to copy every jar under lib/ and one http://community.jboss.org/community/ironjacamar IronJacamar-sjc.jar from bin directory and compile in ant; since I am restricted to maven build environment, I have to somehow enter the version information. How am I supposed to do that?
And that's just first part of my battle. Since the resources I am testing is behind the firewall from my usual development environment, I can't run *profile jbossas-remote-6;* I have to deploy to the isolated environment and somehow run my tests that way. But first I'd like to get through the hump of just setting up the libraries.
Hasn't anyone had the same task, to use maven to set up at least the compile time environment?
Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/618677#618677]
Start a new discussion in IronJacamar at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[jBPM] - Why is Timer event not triggered in J2EE container?
by Gary tse
Gary tse [http://community.jboss.org/people/garytse] created the discussion
"Why is Timer event not triggered in J2EE container?"
To view the discussion, visit: http://community.jboss.org/message/619372#619372
--------------------------------------------------------------
Hi all,
I have a timer event that is suppose to automatically trigger after 3 minutes.
When I'm testing it on standalone Java program, the bpmn works fine and the task following the timer event gets triggered.
However, the timer event just never gets triggered after I put the StatefulKnowledgeSession into a EJB on the server.
This is a portion of the timer (bpmn2)
<boundaryEvent id="_5" name="TimerEvent" attachedToRef="_4" cancelActivity="false" >
<timerEventDefinition>
<timeDuration xsi:type="tFormalExpression">180s</timeDuration>
</timerEventDefinition>
</boundaryEvent>
My stateless session EJB looks like this:
...
public class CommandDelegate implements SessionBean, ICommandDelegateLocalBM, ICommandDelegateRemoteBM {
private static StatefulKnowledgeSession stateful;
public void startProcess(String processId, Map<String, Object> parameters) {
stateful.startProcess(processId, parameters);
}
Here is my test client:
context = new InitialContext(env);
Object obj = context.lookup("ejb/CommandDelegateRemote");
remoteHome = (CommandDelegateRemoteHome)PortableRemoteObject.narrow(obj,CommandDelegateRemoteHome.class);
remote = remoteHome.create();
...
remote.startProcess("TestTimerBPMN", params);
Any ideas anyone?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619372#619372]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[jBPM] - Advice on how to approach CRON based BPMN2 processes
by olddave
olddave [http://community.jboss.org/people/olddave] created the discussion
"Advice on how to approach CRON based BPMN2 processes"
To view the discussion, visit: http://community.jboss.org/message/619044#619044
--------------------------------------------------------------
Hi,
I have the need to run Processes, with no human tasks, on a repeating basis, normally 3 times a day, weekdays and excluding holidays. But I also need to run the same tasks on an ad hoc basis. So if I code a new workitem that is a Start task that uses Quartz scheduler (thus holidays can be supported) I could not run that on an ad hoc basis. Alternately I could use a normal Start task and have a diverging gateway as the first node that tests for a boolean param that represents "run now" it could diverge to a converging gateway and thus to the actual first node that does real work in the Process, the alternate path would hit the new Timer workitem that I would have to code that also used Quartz, this would then hit a converging gateway with the direct run now path to start the actual Process that does the work I need. Another alternative is theh start task with Quartz and also an integrated parameter test for pass through.
Any suggestions on how this problem scenario is best solved?
thx.
Ed
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619044#619044]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months
[jBPM] - Strange error in process with subprocess
by Marco Piraccini
Marco Piraccini [http://community.jboss.org/people/mpiraccini] created the discussion
"Strange error in process with subprocess"
To view the discussion, visit: http://community.jboss.org/message/619331#619331
--------------------------------------------------------------
Hi guys,
I developed that process with a SubProcess (designed with the new BPMN2 editor). The xml definition is attached.
http://community.jboss.org/servlet/JiveServlet/showImage/2-619331-16831/t... http://community.jboss.org/servlet/JiveServlet/downloadImage/2-619331-168...
...when I complet the WorkItem for the UserTask, I have this error:
java.lang.IllegalArgumentException: Completing a node instance that has no outgoing connection not suppoerted.
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.nodeInstanceCompleted(WorkflowProcessInstanceImpl.java:430)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:142)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)
at org.jbpm.workflow.instance.node.CompositeNodeInstance.triggerCompleted(CompositeNodeInstance.java:128)
at org.jbpm.workflow.instance.node.CompositeNodeInstance.nodeInstanceCompleted(CompositeNodeInstance.java:312)
at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:63)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:100)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:143)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:239)
at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:301)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:277)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:333)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:119)
(...)
But -of course- the Task has outgoing connections...it's a bug or am I missing something?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/619331#619331]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 8 months