<!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;">&#160;</p><p>I've been wrestling with this for about a day and a half, now.&#160; 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.&#160; 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;">&#160;</p><p>I am attempting to create a new StatefulKnowledgeSession, and start a process with it, using the JPAKnowledgeService, as described in the documentation.&#160; The code I am using to do this is as follows: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p>&#160; kBase = kbuilder.newKnowledgeBase();</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; // create the entity manager factory and register it in the environment&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>EntityManagerFactory emf =&#160;&#160;&#160;&#160; 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;">&#160;</p><p>kSession =&#160; JPAKnowledgeService.newStatefulKnowledgeSession( kBase, null, env );</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p>Caused by: java.lang.reflect.InvocationTargetException</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at java.lang.reflect.Constructor.newInstance(Constructor.java:494)</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;... 85 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The persistence.xml I've put in place for the JPA persistence looks like this: </p><p>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;</p><p>&#160; &lt;persistence</p><p>&#160; version="1.0"</p><p>&#160; xsi:schemaLocation=</p><p><span>&#160;&#160;&#160; "</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>&#160;&#160;&#160;&#160; </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>&#160;&#160;&#160;&#160; </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>&#160;&#160;&#160;&#160; </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>&#160; 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>&#160; 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>&#160; 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>"&gt;</span></p><p>&#160; </p><p>&#160; &lt;persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA"&gt;</p><p>&#160;&#160;&#160; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;</p><p>&#160;&#160;&#160; &lt;jta-data-source&gt;java:DefaultDS&lt;/jta-data-source&gt;</p><p>&#160;&#160;&#160; &lt;mapping-file&gt;META-INF/JBPMorm.xml&lt;/mapping-file&gt;</p><p>&#160;&#160;&#160; &lt;class&gt;org.drools.persistence.info.SessionInfo&lt;/class&gt;</p><p>&#160;&#160;&#160; &lt;class&gt;org.jbpm.persistence.processinstance.ProcessInstanceInfo&lt;/class&gt;</p><p>&#160;&#160;&#160; &lt;class&gt;org.drools.persistence.info.WorkItemInfo&lt;/class&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;properties&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.max_fetch_depth" value="3"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.show_sql" value="true"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;property name="hibernate.transaction.manager_lookup_class"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; value="org.hibernate.transaction.JBossTransactionManagerLookup"/&gt; </p><p>&#160;&#160;&#160; &lt;/properties&gt;</p><p>&#160; &lt;/persistence-unit&gt;</p><p>&lt;/persistence&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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>