ObjectDB ObjectDB

Apache Tomee 1.5.2: Failed to use JTA (TransactionManager is not found)

#1

Hello, ObjectDB team!

I am struggling with getting ObjectDB 2.5.0 to work with clean Apache Tomee 1.5.2 with transaction-type="JTA". I don't have any configurations in Tomee (objectdb.jar is in Tomee's classpath) nor other parts, excepting the following persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="N7PU1" transaction-type="JTA">
    <provider>com.objectdb.jpa.Provider</provider>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.jdbc.url" value="$objectdb/n7/db1.odb"/>
    </properties>
  </persistence-unit>
</persistence>

I get the following error at deployment time: Failed to use JTA
If I set transaction-type="resource-local", I can deploy, but not with JTA.

May 20, 2013 11:50:32 PM org.apache.tomee.catalina.TomcatWebAppBuilder startInternal
SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardHost[localhost].StandardContext[/natural7]
org.apache.openejb.OpenEJBException: Creating application failed: C:\Users\Mircea\Documents\NetBeansProjects\natural7\target\natural7-1.0-SNAPSHOT: org.apache.openejb.OpenEJBRuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found): com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:836)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:546)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1128)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1033)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBRuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found): com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:690)
... 19 more
Caused by: org.apache.openejb.OpenEJBRuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:118)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.<init>(ReloadableEntityManagerFactory.java:102)
at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:150)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:684)
... 19 more
Caused by: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:121)
at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:32)
at org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(EntityManagerFactoryCallable.java:55)
at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createDelegate(ReloadableEntityManagerFactory.java:116)
... 22 more
Caused by: com.objectdb.o.UserException: Failed to use JTA (TransactionManager is not found)
at com.objectdb.o.MSG.d(MSG.java:74)
at com.objectdb.jpa.EMF.initJta(EMF.java:169)
at com.objectdb.jpa.EMF.init(EMF.java:91)
at com.objectdb.jpa.Provider.newEMF(Provider.java:134)
at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:118)
... 25 more
Caused by: javax.naming.NameNotFoundException: Name [comp/TransactionManager] is not bound in this Context. Unable to find [comp].
at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.objectdb.jpa.EMF.initJta(EMF.java:126)
... 28 more

Any hints please? Thanks a lot in advance.

edit
delete
#2

It seems as a resource loading problem. ObjectDB cannot find TomEE's TransactionManager, which is required in order to use JTA.

You may try removing objectdb.jar from TomEE classpath, and putting it in the web application WEB-INF/lib directory.

Try also using objectdb-jee.jar instead of objectdb.jar.

ObjectDB Support
edit
delete
#3

Thanks for such a quick reply. That's one of the main reasons I love ObjectDB.

It seemed that actually I was putting objectdb.jar in the classpath in a wrong way.
Now I use common.loader from catalina.properties and it works properly.

PS. Your solution worked also (with WEB-INF) because I was not loading the jar properly, but WEB-INF was, so it worked. Anyway, not it works by adding objectdb.jar into common.loader from catalina.properties

edit
delete
#4

You are welcome. Thanks for the update.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.