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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to