UserTransaction not allowed for Container managed Transaction beans

882 views
Skip to first unread message

Tiago Simões Batista

unread,
May 19, 2014, 12:18:24 PM5/19/14
to kundera...@googlegroups.com
Hello all,

This is with the latest trunk
(52b0214981001d28cf26cf2e7ef674c1071a1995). After
https://github.com/impetus-opensource/Kundera/commit/6fbd8805a57a4bc951e2f00cc99885f4dee1ccf4

I was using a private build based on 2.9 with some jpa 2.1 code added,
so i was not expecting transaction management issues. I have looked at
the current and past EntityManagerImpl.onLookUp(), and could not find an
obvious reason for this.

Has anyone seen this before? Is there any known solution for the problem
I am experiencing? It seems that kundera is trying to start a user
transaction on a container manager transaction application.

I am getting this when I try to deploy my application on the latest
promoted build of glassfish:

L16:34:34.117 [com.impetus.kundera.persistence.EntityManagerImpl] ERROR [EntityManagerImpl.java:882] Error during initialization of entity manager, Caused by:
javax.naming.NamingException: Lookup failed for 'java:comp/UserTransaction' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491) ~[glassfish-naming.jar:na]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438) ~[glassfish-naming.jar:na]
at javax.naming.InitialContext.lookup(InitialContext.java:411) ~[na:1.7.0_55]
at javax.naming.InitialContext.lookup(InitialContext.java:411) ~[na:1.7.0_55]
at com.impetus.kundera.persistence.EntityManagerImpl.onLookUp(EntityManagerImpl.java:858) [kundera-core-2.12-B1.jar:na]
at com.impetus.kundera.persistence.EntityManagerImpl.checkTransactionNeeded(EntityManagerImpl.java:833) [kundera-core-2.12-B1.jar:na]
at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:383) [kundera-core-2.12-B1.jar:na]
(snip)
Caused by: javax.naming.NameNotFoundException: Lookup of java:comp/UserTransaction not allowed for Container managed Transaction beans
at com.sun.ejb.containers.BaseContainer.checkUserTransactionLookup(BaseContainer.java:918) [ejb-container.jar:na]
at com.sun.ejb.EjbInvocation.userTransactionLookupAllowed(EjbInvocation.java:460) [ejb-container.jar:na]
at com.sun.enterprise.transaction.TransactionNamingProxy.checkUserTransactionLookupAllowed(TransactionNamingProxy.java:114) ~[na:na]
at com.sun.enterprise.transaction.TransactionNamingProxy.handle(TransactionNamingProxy.java:95) ~[na:na]
at com.sun.enterprise.naming.impl.NamedNamingObjectManager.tryNamedProxies(NamedNamingObjectManager.java:134) ~[glassfish-naming.jar:na]
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:164) ~[glassfish-naming.jar:na]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471) ~[glassfish-naming.jar:na]


My persistence.xml:

<?xml version='1.0' encoding='utf-8'?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="NOSQL_PU">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<!-- filtered value, see src/main/filter-*.properties -->
<property name="kundera.nodes" value="${cassandraHosts}" />
<property name="kundera.port" value="9160" />
<property name="kundera.keyspace" value="MYAPPKS" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
<property name="kundera.ddl.auto.prepare" value="update" />
<property name="kundera.client.property" value="kundera-cassandra.xml" />
<property name="kundera.pool.size.max.active" value="50" />
<property name="kundera.pool.size.max.total" value="50" />
<property name="kundera.batch.size" value="200" />
</properties>
</persistence-unit>
</persistence>

and I Inject the entity manager like this on a @Stateless EJB:

@PersistenceContext(unitName = "NOSQL_PU")
private EntityManager em;



Vivek Mishra

unread,
May 19, 2014, 1:38:43 PM5/19/14
to kundera...@googlegroups.com
Can you try with 

  <persistence-unit name="NOSQL_PU" transaction-type=”RESOURCE_LOCAL”>

in persistence.xml?

-Vivek





--
You received this message because you are subscribed to the Google Groups "kundera-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kundera-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages