[jboss-user] [jBPM] - Re: Service task exception with non-JTA transaction manager persistence and Tomcat

navisdrools do-not-reply at jboss.com
Mon Mar 5 14:49:52 EST 2012


navisdrools [https://community.jboss.org/people/navisdrools] created the discussion

"Re: Service task exception with non-JTA transaction manager persistence and Tomcat"

To view the discussion, visit: https://community.jboss.org/message/721635#721635

--------------------------------------------------------------
I resolved my problem by using all Spring beans. 

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="com.navis.control.persistence.jpa" />
    </bean>


    <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("ApplicationContext.xml");
        Environmentenv = KnowledgeBaseFactory.newEnvironment(); 
        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,applicationContext.getBean("entityManagerFactory"));
        env.set(EnvironmentName.TRANSACTION_MANAGER, applicationContext.getBean("txManager"));
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("aFile"), ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newClassPathResource("aRule"), ResourceType.DRL);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();

StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://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/20120305/848fc08d/attachment.html 


More information about the jboss-user mailing list