I am using currently the standard technique of jBPM Business Application as following:
- Business Application Kjar
- Business Application Model (I moved the models into Kjar application)
- Business Application Service
I tried to use JPA work item to do CRUD operations on Data Objects. it worked fine on Business-Central. but did not work on Business Application and got this errors:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is [Error: could not create constructor: null]
[Near : {... new org.jbpm.process.workitem.jpa. ....}]
and
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
My persistence.xml:
<persistence-unit name="myPersistenceUnit" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<class>com.company.model.Person</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<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.id.new_generator_mappings" value="false"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
</properties>
</persistence-unit>
and in my kie-deployment-descriptor.xml:
<work-item-handlers>
<work-item-handler>
<resolver>mvel</resolver>
<identifier>new org.jbpm.process.workitem.jpa.JPAWorkItemHandler("myPersistenceUnit", classLoader)</identifier>
<parameters/>
<name>JPA</name>
</work-item-handler>
</work-item-handlers>