[jboss-user] [jBPM] - jbpm hibernate persistence

J J do-not-reply at jboss.com
Mon Mar 14 22:39:23 EDT 2011


J J [http://community.jboss.org/people/joshjdevl] created the discussion

"jbpm hibernate persistence"

To view the discussion, visit: http://community.jboss.org/message/593144#593144

--------------------------------------------------------------
Hi,

We are using Hibernate as our persistence implementatio and Bitronix. I would like to configure JBPM peristence to use a hibernate entity manager so it can participate in our application transactions and go to our existing databases.

I've done something like this where I inject our jtaTransactionManager.

        // create the entity manager factory and register it in the environment
        final EntityManagerFactory emf = new EntityManagerFactoryImpl(
                getSessionFactory(), PersistenceUnitTransactionType.JTA, true, null);


        final Environment env = KnowledgeBaseFactory.newEnvironment();
        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
        // env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, emf);
        env.set(EnvironmentName.TRANSACTION_MANAGER, jtaTransactionManager);
        // create a new knowledge session that uses JPA to store the runtime
        // state


        final StatefulKnowledgeSession ksession =
                JPAKnowledgeService.newStatefulKnowledgeSession(getKnowledgeBase(), null, env);


However, I receive the following error. Any clues/hints?

Caused by: java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
          at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:116)
          ... 34 more
Caused by: java.lang.RuntimeException: Could not commit session
          at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:136)
          ... 39 more
Caused by: java.lang.NullPointerException
          at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:125)
          ... 39 more
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/593144#593144]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110314/f45f192d/attachment.html 


More information about the jboss-user mailing list