Tim Kutz [
https://community.jboss.org/people/tim.kutz] created the discussion
"InvocationTargetException when creating StatefulKnowledgeSession public
StatefulKnowledgeSession createNewKnowledgeSession() { // create a new knowledge
session that uses JPA to store the runtime state StatefulKnowledgeSession kSession =
null; try"
To view the discussion, visit:
https://community.jboss.org/message/722605#722605
--------------------------------------------------------------
Hello -
I've been wrestling with this for about a day and a half, now. My environment is jBPM
5.2.0.Final, running on JBoss 5.1.0.GA, with Java 1.5.0_12, under 64-bit Windows 7.
It's entirely possible that I am missing some portion of configuration, but I'm
not able to determine what it is, exactly, that I'm missing.
I am attempting to create a new StatefulKnowledgeSession, and start a process with it,
using the JPAKnowledgeService, as described in the documentation. The code I am using to
do this is as follows:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("ImmunizationProcess.bpmn"),
ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newClassPathResource("SchoolFormProcess.bpmn"),
ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newClassPathResource("LegacySubscriptionProcess.bpmn"),
ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newClassPathResource("SubscriptionMasterProcess.bpmn"),
ResourceType.BPMN2);
kBase = kbuilder.newKnowledgeBase();
// create the entity manager factory and register it in the environment
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"org.jbpm.persistence.jpa" );
env = KnowledgeBaseFactory.newEnvironment();
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
env.set( EnvironmentName.TRANSACTION_MANAGER, jtaManager);
kSession = JPAKnowledgeService.newStatefulKnowledgeSession( kBase, null, env );
When it reaches this last line, it throws an InvocationTargetException, which I've
managed to narrow down to the constructor call on SingleSessionCommandService, which
appears to not exist:
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at
org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
... 85 more
The persistence.xml I've put in place for the JPA persistence looks like this:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<persistence
version="1.0"
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
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="
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"
xmlns="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.jbpm.persistence.jpa"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:DefaultDS</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.OracleDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
Any and all help would be appreciated, and I can provide additional information if
needed.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/722605#722605]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]