Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
http://groups.google.com/group/kundera-discuss/subscribe
Apache License 2.0
903 stars 233 forks source link

Container managed transactions: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans #651

Open tsbatista opened 10 years ago

tsbatista commented 10 years ago

This illustrates what I think is wrong:

https://github.com/tsbatista/kundera-cmt

Basically, if I try to use kundera and CMT under glassfish, it breaks as you try to lookup a user transaction here: https://github.com/impetus-opensource/Kundera/blob/273c13342ddd1aceed0cd23504649926ce8fdb84/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerImpl.java#L858

Is there any way to use CMT on glassfish?

mevivs commented 10 years ago

@tsbatista check this out https://github.com/impetus-opensource/Kundera/wiki/Transaction-Management.

Most of JTA implementation like atomikos, hibernate one etc are bound with JDBC API which is not applicable in case of NoSQL databases and Kundera. So Kundera brings in its own implementation of JTA transaction and which would require to define binding

ctx.lookup("java:comp/UserTransaction");

With tomcat you can easily bind this, but for EJB containers i can't find a way for the same. Would definitely like to know your views/suggestions on this!

-Vivek

tsbatista commented 10 years ago

I dont have much time right now. I will look at this during the weekend and get back to you if I have any ideas.

mevivs commented 10 years ago

@tsbatista let's keep it open for discussion. Would appreciate your views whenever you get some time to discuss.

-Vivek

hwaastad commented 9 years ago

Hi, I've started to test Kundera along with TomEE and have met a couple of issues, and maybe related to this discussion.

Please bind [com.impetus.kundera.persistence.jta.KunderaJTAUserTransaction] for :{java:comp/UserTransaction} lookupclass org.apache.openejb.core.CoreUserTransaction

I asked TomEE dev's if it's possible to fix this by using resources og setting system properties, but Romain (at TomEE) suggested this:

The easiest is to ask kundera to support a kunderaUserTransactionProvider in the persistence unit properties. It is trivial for them to do and you don't break other JTA usages then.

Side note: this is more or less what does all JPA provider: having a little SPI configurable in persistence unit properties to get the transactional environment.

Would this be doable?

br hw

mevivs commented 9 years ago

@hwaastad
Let me think about and post an update on this.

-Vivek

hwaastad commented 9 years ago

Hi, sure, and I'll happily help testing when needed :-)

mevivs commented 9 years ago

@hwaastad Sorry for late response, kinda got busy with some stuff. Can you please share a sample project to try it my end with TomEE?

-Vivek

hwaastad commented 9 years ago

Hi, I'll see if I can push a project to github during the weekend.

Edit: https://github.com/hwaastad/KunderaDebugTest.git

Pretty simple implementation just for providing the error described

br hw

hwaastad commented 9 years ago

@mevivs Did you have a look at this issue?

br hw

cristof commented 9 years ago

@mevivs

I've stumbled with this same problem when trying to use kundera in a JavaEE project. It makes kundera a no-go for container managed transactions. Any news about the solution proposed by @hwaastad based on the suggestion of Romain from Tomee?

Regards, Paulo