1
votes

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.

1
Why not ask the question, in JBoss6 plenty of people are deploying it without problems, so what is different in JBoss7? (with the same version of DataNucleus) - DataNucleus
I am developing a product some what similar to hibernate-envers with little audit features using datanucleus. I like annotations. Using Since jboss7 is modular and fast. Further jboos6 is not part of EAP. To begin with I will finish implementation of my product on jboss as7 and figure out a way to add JDO as a first class citizen of jboss as7. - kiran.kumar M
@DataNucleus Classloading has changed in jboos as7. Its controlled by modules and jboss-deployent-structure.xml Configuration of the server is now centralized (standalone.xml/domain.xml) there are NO *-ds files. Logging has changed i am yet to figure out how to print datanucleus logs. Now it uses JCA1.6 (IronJacamar). could the switch to JCA1.6 be the cause of above behavior? - kiran.kumar M
I have defined datanucleus.connection.resourceType = JTA , In the debug I found resourceType in ConnectionFactoryImpl.java is showing as nonTX. The constructor ConnectionFactoryImpl(StoreManager storeMgr, String resourceType) is entering non-transactional block. I expect it to execute Transactional. Can any one help-- whats going wrong. - kiran.kumar M
There are always two connection factories ... tx and non-tx. Doesn't mean your persistence code (which you don't quote) is using a 'non-tx' connection - DataNucleus

1 Answers

1
votes

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 datanucleus.org/servlet/forum/viewthread_thread,4663_offset helped