<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
InvocationTargetException when creating StatefulKnowledgeSession         public StatefulKnowledgeSession createNewKnowledgeSession()         {                 // create a new knowledge session that uses JPA to store the runtime state                 StatefulKnowledgeSession kSession = null;                 try
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/tim.kutz">Tim Kutz</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/722605#722605">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hello - </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</p><p> kbuilder.add(ResourceFactory.newClassPathResource("ImmunizationProcess.bpmn"), ResourceType.BPMN2);</p><p> kbuilder.add(ResourceFactory.newClassPathResource("SchoolFormProcess.bpmn"), ResourceType.BPMN2);</p><p> kbuilder.add(ResourceFactory.newClassPathResource("LegacySubscriptionProcess.bpmn"), ResourceType.BPMN2);</p><p> kbuilder.add(ResourceFactory.newClassPathResource("SubscriptionMasterProcess.bpmn"), ResourceType.BPMN2);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  kBase = kbuilder.newKnowledgeBase();</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  // create the entity manager factory and register it in the environment  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>EntityManagerFactory emf =     Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );</p><p> env = KnowledgeBaseFactory.newEnvironment();</p><p> env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );</p><p> env.set( EnvironmentName.TRANSACTION_MANAGER, jtaManager); </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>kSession =  JPAKnowledgeService.newStatefulKnowledgeSession( kBase, null, env );</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When it reaches this last line, it throws an InvocationTargetException, which I've managed to narrow down to the constructor call on <span style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: #ffffff; font-size: small;">SingleSessionCommandService</span>, which appears to not exist:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Caused by: java.lang.reflect.InvocationTargetException</p><p>          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)</p><p>          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)</p><p>          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)</p><p>          at java.lang.reflect.Constructor.newInstance(Constructor.java:494)</p><p>          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)</p><p>          ... 85 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The persistence.xml I've put in place for the JPA persistence looks like this: </p><p><?xml version="1.0" encoding="UTF-8" standalone="yes"?></p><p>  <persistence</p><p>  version="1.0"</p><p>  xsi:schemaLocation=</p><p><span>    "</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a></p><p><span>     </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd</a></p><p><span>     </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a></p><p><span>     </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/orm_1_0.xsd</a><span>"</span></p><p><span>  xmlns:orm="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/orm" target="_blank">http://java.sun.com/xml/ns/persistence/orm</a><span>"</span></p><p><span>  xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></p><p><span>  xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>"></span></p><p>  </p><p>  <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA"></p><p>    <provider>org.hibernate.ejb.HibernatePersistence</provider></p><p>    <jta-data-source>java:DefaultDS</jta-data-source></p><p>    <mapping-file>META-INF/JBPMorm.xml</mapping-file></p><p>    <class>org.drools.persistence.info.SessionInfo</class></p><p>    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class></p><p>    <class>org.drools.persistence.info.WorkItemInfo</class></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <properties></p><p>      <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/></p><p>      <property name="hibernate.max_fetch_depth" value="3"/></p><p>      <property name="hibernate.hbm2ddl.auto" value="update"/></p><p>      <property name="hibernate.show_sql" value="true"/></p><p>      <property name="hibernate.transaction.manager_lookup_class"</p><p>                value="org.hibernate.transaction.JBossTransactionManagerLookup"/> </p><p>    </properties></p><p>  </persistence-unit></p><p></persistence></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Any and all help would be appreciated, and I can provide additional information if needed.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/722605#722605">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>