Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Error obtaining the Transaction Manager(jndi lookup fails)
Error obtaining the Transaction Manager [message #1254997] Mon, 24 February 2014 02:10 Go to next message
David Libke is currently offline David Libke
Messages: 1
Registered: February 2014
Location: Atlanta GA
Junior Member
Using Eclipse 4.3.1, EclipseLink 2.5.0, Glassfish 4.0, and PostgreSQL 9.3.2. The error occurs from JPA Tools->Generate tables from Entities...

persistence.xml:
<persistence version="2.1" ...
persistence/persistence_2_1.xsd">

<persistence-unit name="libkedesign" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/libkedesignDS</jta-data-source>
<properties>
<property name="javax.persistence.schema-generation.database.action"
value="create" />
<property name="javax.persistence.schema-generation.scripts.action"
value="drop-and-create" />
<property name="javax.persistence.schema-generation.scripts.drop-target"
value="/src/main/resouece/ld-db-drop.ddl" />
<property name="javax.persistence.schema-generation.scripts.create-target"
value="/src/main/resouece/ld-db-create.ddl" />
<property name="eclipselink.deploy-on-startup" value="true" />
<property name="eclipselink.target-server" value="Glassfish" />
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.application-location"
value="/Users/dlibke/Workspaces/MyEclipse Pro 2014/libkedesign/enterprise/domain/src/main/resources" />
<property name="eclipselink.create-ddl-jdbc-file-name"
value="ld-db-createDDL.sql" />
<property name="eclipselink.drop-ddl-jdbc-file-name" value="ld-db-dropDDL.sql" />
</properties>
</persistence-unit>
</persistence>

Stack Trace:
Local Exception Stack:
Exception [EclipseLink-23004] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error obtaining the Transaction Manager
Internal Exception: Exception [EclipseLink-23001] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error looking up external Transaction resource under JNDI name [java:appserver/TransactionManager]
Internal Exception: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at org.eclipse.persistence.exceptions.TransactionException.errorObtainingTransactionManager(TransactionException.java:125)
at org.eclipse.persistence.transaction.JTATransactionController.<init>(JTATransactionController.java:69)
at org.eclipse.persistence.transaction.glassfish.GlassfishTransactionController.<init>(GlassfishTransactionController.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.newInstanceFromClass(PrivilegedAccessHelper.java:417)
at org.eclipse.persistence.platform.server.ServerPlatformBase.initializeExternalTransactionController(ServerPlatformBase.java:295)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.preConnectDatasource(DatabaseSessionImpl.java:775)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:733)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:681)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:140)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
Caused by: Exception [EclipseLink-23001] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error looking up external Transaction resource under JNDI name [java:appserver/TransactionManager]
Internal Exception: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at org.eclipse.persistence.exceptions.TransactionException.jndiLookupException(TransactionException.java:47)
at org.eclipse.persistence.transaction.AbstractTransactionController.jndiLookup(AbstractTransactionController.java:454)
at org.eclipse.persistence.transaction.glassfish.GlassfishTransactionController.acquireTransactionManager(GlassfishTransactionController.java:44)
at org.eclipse.persistence.transaction.JTATransactionController.<init>(JTATransactionController.java:67)
... 21 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at org.eclipse.persistence.transaction.AbstractTransactionController.jndiLookup(AbstractTransactionController.java:452)
... 23 more
Caused by: javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:229)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471)
... 26 more
Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:167)
... 27 more

Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-23004] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error obtaining the Transaction Manager
Internal Exception: Exception [EclipseLink-23001] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error looking up external Transaction resource under JNDI name [java:appserver/TransactionManager]
Internal Exception: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:762)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:140)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
Caused by: Exception [EclipseLink-23004] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error obtaining the Transaction Manager
Internal Exception: Exception [EclipseLink-23001] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error looking up external Transaction resource under JNDI name [java:appserver/TransactionManager]
Internal Exception: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at org.eclipse.persistence.exceptions.TransactionException.errorObtainingTransactionManager(TransactionException.java:125)
at org.eclipse.persistence.transaction.JTATransactionController.<init>(JTATransactionController.java:69)
at org.eclipse.persistence.transaction.glassfish.GlassfishTransactionController.<init>(GlassfishTransactionController.java:36)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.newInstanceFromClass(PrivilegedAccessHelper.java:417)
at org.eclipse.persistence.platform.server.ServerPlatformBase.initializeExternalTransactionController(ServerPlatformBase.java:295)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.preConnectDatasource(DatabaseSessionImpl.java:775)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:733)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:681)
... 9 more
Caused by: Exception [EclipseLink-23001] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.TransactionException
Exception Description: Error looking up external Transaction resource under JNDI name [java:appserver/TransactionManager]
Internal Exception: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at org.eclipse.persistence.exceptions.TransactionException.jndiLookupException(TransactionException.java:47)
at org.eclipse.persistence.transaction.AbstractTransactionController.jndiLookup(AbstractTransactionController.java:454)
at org.eclipse.persistence.transaction.glassfish.GlassfishTransactionController.acquireTransactionManager(GlassfishTransactionController.java:44)
at org.eclipse.persistence.transaction.JTATransactionController.<init>(JTATransactionController.java:67)
... 21 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:appserver/TransactionManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at org.eclipse.persistence.transaction.AbstractTransactionController.jndiLookup(AbstractTransactionController.java:452)
... 23 more
Caused by: javax.naming.NameNotFoundException: No object bound for java:appserver/TransactionManager [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:229)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471)
... 26 more
Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:167)
... 27 more

What am I missing or have incorrect

Dave
Re: Error obtaining the Transaction Manager [message #1255516 is a reply to message #1254997] Mon, 24 February 2014 14:27 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
This is occuring because org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68) is being called, which uses the current persistence.xml settings to try and run. Unfortunately the persistence unit is configured to run within Glassfish with a transaction manager, but the code is being executed locally.

You will need to change the persistence unit settings to run outside the glassfish server for table generation to work; you will need to remove the datasource and server definition and then define the javax.persistence.jdbc properties required to connect to the database since there is no datasource available. The properties are shown here:
https://wiki.eclipse.org/EclipseLink/Examples/JPA/Configure
with an example here:
https://wiki.eclipse.org/EclipseLink/Examples/JPA/OutsideContainer
Previous Topic:Future of DBWS webservice generation
Next Topic:Reload Persistence Unit at Runtime
Goto Forum:
  


Current Time: Fri Oct 24 08:45:45 GMT 2014

Powered by FUDForum. Page generated in 0.09505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software