Atomikos Forum

DataNucleus + Atomikos = no worky :(

Hi all,

I've got a project where I'm trying to use Atomikos with various ORMs & DBs to compare function & performance.

So far, I've tested Hibernate+Atomikos+Derby, which worked.  Next, I'm trying to use DataNucleus+Atomikos+Derby, and I'm having trouble.

First problem is dumb:  AtomikosDataSourceBean#toString() throws depending on its state.  That shouldn't be the case.  You should be able to call toString() at **any** time and not have it throw on you.  To get around that, I had to decrease DataNucleus.Connection logging to INFO (from DEBUG -- see

Second problem:  the two products aren't working nicely together.

All code, with reproducible test cases, is available at is a simple Maven project that's a plug-in point for DataNucleus that lets DataNucleus find the TransactionManager (similar to Atomikos's Hibernate integration).  It needs to be built & installed to your local maven repo.  (See for more info on DataNucleus's JTA extension point.)  Build & install it by extracting, changing to the archive's "trunk" directory & issuing the command "mvn clean install". is a Maven project that uses Maven profiles along with Spring 3.1 profiles to activate different components during the test.  DataNucleus is currently the default ORM profile.  To run the tests that produce the errors, extract the archive and run "mvn clean test".  To see Hibernate work successfully on the very same tests, run "mvn clean test -Dorm=hib -Ddb=derby -Djta=atomikos".

Can anyone tell me why DataNucleus is failing to work with Atomikos?

Matthew Adams Send private email
Monday, November 07, 2011
Burned a couple of days on this now.  About to give up on Atomikos & try something else to see if it'll work.

Atomikos guys, can you please have a look?  Latest code is at

They're executable maven projects.  Just extract & "mvn install" the latest dn-atomikos-*.zip, then extract & "mvn clean test" the latest db.jta-*.zip and you'll see the exceptions & test failures.

Matthew Adams Send private email
Wednesday, November 09, 2011
Got it working.  The primary issue is that when injecting an EntityManager from Spring via the @PersistenceContext annotation, you need to specify @PersistenceContext(type=PersistenceContextType.EXTENDED).  It was difficult to identify due to the fact that Atomikos's AtomikosDataSourceBean#toString() (see default82df.html?82985_jc858bq999tqtfvk) was throwing on me and Spring's PersistenceAnnotationBeanPostProcessor has a bug in it (see

Matthew Adams Send private email
Thursday, November 10, 2011
Thanks - then please ignore my post in the Spring forums :-)
Guy Pardon Send private email
Wednesday, November 30, 2011

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics