If you use BTM for JTA implementation, you cannot config your hibernate like
this, please check the BTM online document.
You have to config data source in BTM properties files then refer to it in
hibernate.
2010/11/26 Bennet Joseph <josedrools(a)gmail.com>
HI
can you please elaborate on this please, i didn't understand.
in the previous example no where i used datasource to connect.
thanks,
jose
2010/11/25 tangrui.cn(a)gmail.com <tangrui.cn(a)gmail.com>
If you use the JTA transaction manager, you should use Oracle's XA data
> source rather than the thin client.
>
> And Oracle needs specific permissions to run under JTA environment. Please
> check this page.
>
>
>
http://docs.codehaus.org/display/BTM/FAQ#FAQ-WhyisOraclethrowingaXAExcept...
>
> 2010/11/25 Bennet Joseph <josedrools(a)gmail.com>
>
>> Hi All,
>>
>> follwoing is the code i used to get the session using
>> JPAKnowledgeService.newStatefulKnowledgeSession.
>>
>> table for the mentioned classes are getting created, after that
>> JPAKnowledgeService.newStatefulKnowledgeSession() method throws following
>> exception....
>>
>> EntityManagerFactory emf =
>> Persistence.createEntityManagerFactory( "org.drools.persistence.jpa"
);
>>
>> Environment env = KnowledgeBaseFactory.newEnvironment();
>>
>> env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
>> env.set( EnvironmentName.TRANSACTION_MANAGER,
>> TransactionManagerServices.getTransactionManager() );
>>
>> StatefulKnowledgeSession ksession =
>> JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
>>
>> -------------------------
>> persistence.xml
>>
>> i copied only persistent unit part...
>>
>> <persistence-unit name="org.drools.persistence.jpa">
>>
>> <class>org.drools.persistence.session.SessionInfo</class>
>>
>>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
>>
>>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
>>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
>>
>>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
>>
>>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
>>
>>
>> <properties>
>> <property name="hibernate.dialect"
>> value="org.hibernate.dialect.Oracle10gDialect" />
>> <property name="hibernate.max_fetch_depth"
value="3" />
>> <property name="hibernate.hbm2ddl.auto"
value="update" />
>> <property name="hibernate.show_sql"
value="true" />
>> <property
name="hibernate.transaction.manager_lookup_class"
>>
>> value="org.hibernate.transaction.BTMTransactionManagerLookup" />
>> <property name="hibernate.connection.url"
>> value="jdbc:oracle:thin:@192.168.4.93:1521:POST" />
>> <property name="hibernate.connection.driver_class"
>> value="oracle.jdbc.driver.OracleDriver" />
>> <property name="hibernate.connection.password"
>> value="voms_test" />
>> <property name="hibernate.connection.username"
>> value="voms_test" />
>> <property name="java.naming.factory.initial"
>> value="bitronix.tm.jndi.BitronixInitialContextFactory"/>
>> <!--
>> <property name="hibernate.format_sql"
value="true"/>
>> -->
>> </properties>
>>
>> </persistence-unit>
>>
>> but it throws exception
>>
>> java.lang.IllegalStateException:
>> java.lang.reflect.InvocationTargetException
>> at
>>
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:137)
>> at
>>
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:61)
>> * at
>>
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:109)
>> at com.sample.FirstTest.main(FirstTest.java:87)*
>> Caused by: java.lang.reflect.InvocationTargetException
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
>> Source)
>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
>> Source)
>> at java.lang.reflect.Constructor.newInstance(Unknown Source)
>> at
>>
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:123)
>> ... 3 more
>> Caused by: java.lang.RuntimeException: Could not commit session or
>> rollback
>> at
>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:132)
>> ... 8 more
>> Caused by: java.lang.RuntimeException: Unable to rollback transaction
>> at
>>
org.drools.persistence.session.JtaTransactionManager.rollback(JtaTransactionManager.java:181)
>> at
>>
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:130)
>> ... 8 more
>> Caused by: java.lang.NullPointerException
>> at
>>
org.drools.persistence.session.JtaTransactionManager.rollback(JtaTransactionManager.java:178)
>> ... 9 more
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> 唐睿
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users