If you use the JTA transaction manager, you should use Oracle&#39;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">&lt;<a href="mailto:josedrools@gmail.com">josedrools@gmail.com</a>&gt;</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( &quot;org.drools.persistence.jpa&quot; );<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>    &lt;persistence-unit name=&quot;org.drools.persistence.jpa&quot;&gt;<br>    <br>    &lt;class&gt;org.drools.persistence.session.SessionInfo&lt;/class&gt;<br>


    &lt;class&gt;org.drools.persistence.processinstance.ProcessInstanceInfo&lt;/class&gt;<br>    &lt;class&gt;org.drools.persistence.processinstance.ProcessInstanceEventInfo&lt;/class&gt;<br>    &lt;class&gt;org.drools.persistence.processinstance.WorkItemInfo&lt;/class&gt;<br>


    &lt;class&gt;org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo&lt;/class&gt;<br>    &lt;class&gt;org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable&lt;/class&gt;    <br>

<br>
        &lt;properties&gt;<br>            &lt;property name=&quot;hibernate.dialect&quot; value=&quot;org.hibernate.dialect.Oracle10gDialect&quot; /&gt;<br>            &lt;property name=&quot;hibernate.max_fetch_depth&quot; value=&quot;3&quot; /&gt;<br>


            &lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;update&quot; /&gt;<br>            &lt;property name=&quot;hibernate.show_sql&quot; value=&quot;true&quot; /&gt;<br>              &lt;property name=&quot;hibernate.transaction.manager_lookup_class&quot;<br>


                value=&quot;org.hibernate.transaction.BTMTransactionManagerLookup&quot; /&gt;<br>            &lt;property name=&quot;hibernate.connection.url&quot; value=&quot;jdbc:oracle:thin:@192.168.4.93:1521:POST&quot; /&gt;<br>


            &lt;property name=&quot;hibernate.connection.driver_class&quot; value=&quot;oracle.jdbc.driver.OracleDriver&quot; /&gt;<br>            &lt;property name=&quot;hibernate.connection.password&quot; value=&quot;voms_test&quot; /&gt;<br>


            &lt;property name=&quot;hibernate.connection.username&quot; value=&quot;voms_test&quot; /&gt;<br>            &lt;property name=&quot;java.naming.factory.initial&quot; value=&quot;bitronix.tm.jndi.BitronixInitialContextFactory&quot;/&gt;<br>


            &lt;!--<br>                &lt;property name=&quot;hibernate.format_sql&quot; value=&quot;true&quot;/&gt;<br>            --&gt;<br>        &lt;/properties&gt;<br><br>    &lt;/persistence-unit&gt;<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.&lt;init&gt;(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.&lt;init&gt;(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>