If you use the JTA transaction manager, you should use Oracle's XA data source rather than the thin client.<br><br>And Oracle needs specific permissions to run under JTA environment. Please check this page. <br><br><a href="http://docs.codehaus.org/display/BTM/FAQ#FAQ-WhyisOraclethrowingaXAExceptionduringinitializationofmydatasource%3F">http://docs.codehaus.org/display/BTM/FAQ#FAQ-WhyisOraclethrowingaXAExceptionduringinitializationofmydatasource%3F</a><br>
<br><div class="gmail_quote">2010/11/25 Bennet Joseph <span dir="ltr"><<a href="mailto:josedrools@gmail.com">josedrools@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi All,<br><br>follwoing is the code i used to get the session using JPAKnowledgeService.newStatefulKnowledgeSession.<br><br>table for the mentioned classes are getting created, after that JPAKnowledgeService.newStatefulKnowledgeSession() method throws following exception....<br>
<br> EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.drools.persistence.jpa" );<br> <br> Environment env = KnowledgeBaseFactory.newEnvironment();<br> <br>
env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );<br> env.set( EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager() );<br><br> StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );<br>
<br>-------------------------<br>persistence.xml<br><br>i copied only persistent unit part...<br><br> <persistence-unit name="org.drools.persistence.jpa"><br> <br> <class>org.drools.persistence.session.SessionInfo</class><br>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class><br> <class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class><br> <class>org.drools.persistence.processinstance.WorkItemInfo</class><br>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class><br> <class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class> <br>
<br>
<properties><br> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /><br> <property name="hibernate.max_fetch_depth" value="3" /><br>
<property name="hibernate.hbm2ddl.auto" value="update" /><br> <property name="hibernate.show_sql" value="true" /><br> <property name="hibernate.transaction.manager_lookup_class"<br>
value="org.hibernate.transaction.BTMTransactionManagerLookup" /><br> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.4.93:1521:POST" /><br>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" /><br> <property name="hibernate.connection.password" value="voms_test" /><br>
<property name="hibernate.connection.username" value="voms_test" /><br> <property name="java.naming.factory.initial" value="bitronix.tm.jndi.BitronixInitialContextFactory"/><br>
<!--<br> <property name="hibernate.format_sql" value="true"/><br> --><br> </properties><br><br> </persistence-unit><br><br>but it throws exception<br>
<br>java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException<br> at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:137)<br> at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:61)<br>
<b> at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:109)<br> at com.sample.FirstTest.main(FirstTest.java:87)</b><br>Caused by: java.lang.reflect.InvocationTargetException<br>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)<br> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)<br>
at java.lang.reflect.Constructor.newInstance(Unknown Source)<br> at org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:123)<br> ... 3 more<br>Caused by: java.lang.RuntimeException: Could not commit session or rollback<br>
at org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:132)<br> ... 8 more<br>Caused by: java.lang.RuntimeException: Unable to rollback transaction<br> at org.drools.persistence.session.JtaTransactionManager.rollback(JtaTransactionManager.java:181)<br>
at org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:130)<br> ... 8 more<br>Caused by: java.lang.NullPointerException<br> at org.drools.persistence.session.JtaTransactionManager.rollback(JtaTransactionManager.java:178)<br>
... 9 more<br><br><br><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>唐睿<br>