I need to deploy datanucleus using JCA. My application is built on ejb3 and CDI. I am not able to proceed after this error.
21:29:38,789 SEVERE [DataNucleus.Datastore.Schema] (http--10.91.10.49-8080-1) Failed initialising database.: org.datanucleus.exceptions.
NucleusDataStoreException: You cannot commit during a managed transaction!
at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.close(ConnectionFactoryImpl.java:522) [datanucleus-rdbms-3.0.0-m6.jar:]
I am using LocalTransaction with the datasource managed by Jboss I have defined
standalone.xml driver-class oracle.jdbc.driver.OracleDriver
ra.xml
transaction-support LocalTransaction
jdopersistance.xml
datanucleus.jtaLocator custom_jndi
datanucleus.jtaJndiLocation java:jboss/TransactionManager
datanucleus.connection.resourceType JTA
The resource-adapter defined in standalone.xml is properly binding and I am able to access it inside an ejb. The above exception occurs when I try to access the persistence manager.
Question : Did anyone got managed transactions with managed datasource under JCA working for datnucleus on Jboss as 7
Any clues on Why is datanucleus trying to commit even after I defined datanucleus.connection.resourceType = JTA
Other info
jdbc driver ojdbc6.jar
datanucleus -datanucleus-jca-3.0.0-m6.rar
Jboss as 7 final
jdk 1.6
Ubuntu 8.10
Oracle 11g
Answer
Thanks andy it works after I created two separate datasources 1) with JTA 2) without JTA. datanucleus.ConnectionFactory2Name ==> points to non-JTA. Addtionally i had to add datanucleus.jtaJndiLocation = java:jboss/TransactionManager. Seems like this is specific to oracle, I am yet to try with other databases. Discussion at www.datanucleus.org/servlet/forum/viewthread_thread,4663_offset helped.