This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes deploy jar with jpa Entites to Glassfish Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "deploy jar with jpa Entites to Glassfish" Watch "deploy jar with jpa Entites to Glassfish" New topic

deploy jar with jpa Entites to Glassfish

Felix Jauch

Joined: Nov 23, 2006
Posts: 3
Hi @all,

I try to deploy a simple JPA Example on Glassfish, but the injection of my persistenceUnit fails always on this line:

private EntityManager manager;

the persistence.xml is the following:
<persistence "xmlns etc etc.">
<persistence-unit name="testUnit" transaction-type="JTA">
<property name="toplink.ddl-generation" value="create-tables"/>
<property name=""

The datasource MySqlDS is configured on Glassfish an the ping over the admin console works fine. This persistence.xml is in the meta-inf directory of the entities.jar. I pack the entities.jar to my ejb-module jar file (in the root) and deploy the jar contains the ejbs and entities.jar with the admin console.

But neither the database schema is generated nor the persistenceunit is available. Whats Wrong??

thanks in advanced

Mike Keith
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
Get rid of your entities.jar. Put the persistence.xml file in the META-INF dir of the ejb-module.jar and the entitiy classes in the root dir of the ejb-module.jar (with the session bean classes). That is the simplest way to deploy.


Pro JPA 2: Mastering the Java Persistence API
I agree. Here's the link:
subject: deploy jar with jpa Entites to Glassfish