users@glassfish.java.net

Problem with Persistence

From: GA <lupius_at_gmail.com>
Date: Wed, 11 Sep 2013 19:30:53 +0300

Hello,

I'm trying out Glassfish v4 - really simple web application (2 JSPs, 1
Servlet, 2 EJBs and JPA (3 Classes).

However I've run aground with the following error:

 Error occurred during deployment: Exception while deploying the app
[gtwcustreport] : 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.NameNotFoundException: remaining name:
java:appserver/TransactionManager. Please see server.log for more details.

Funny thing is, that occurs under unknown circumstances.

I'm running 2 separate servers: 1 for Production and 1 for Development. On
the dev I'm directly deploying via IntelliJ. Both as an exploded web app
and packaged it works fine for several deployments (after code changes)
then it throws this exception and in order to re-deploy a server restart is
required.

Interesting is that besides once, it's throwing the error every time on
the production one when trying to upload the WAR archive.

Both servers have the same configuration, in terms of the DataPools and the
JDBC Resources (pointing to different mysql servers). Pinging is working
fine on both.

Also when the deployment succeeds, writing and reading from the DB is
working properly.

Here is my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="GTWunit" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/gtwcust</jta-data-source>
        <class>net.metarex.ga.jpa.Ugly</class>
        <class>net.metarex.ga.jpa.LocationBG</class>
        <class>net.metarex.ga.jpa.Productcode</class>
    </persistence-unit>
</persistence>

I'm injecting the EntityManager in the EJBs with
@PersistenceContext(unitName = "GTWunit")

I have glassfish v4 libs as provided build dependency and the javaee-6 api
from maven as compile.


So it's really frustrating... perhaps someone can help?