File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Author

deploy jar with jpa Entites to Glassfish

Felix Jauch
Greenhorn

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:

@PersistenceUnit(unitName="testUnit")
private EntityManager manager;

the persistence.xml is the following:
<persistence "xmlns etc etc.">
<persistence-unit name="testUnit" transaction-type="JTA">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<jta-data-source>jdbc/MySqlDS</jta-data-source>
<properties>
<property name="toplink.ddl-generation" value="create-tables"/>
<property name="toplink.platform.class.name"
value="oracle.toplink.essentials.platform.MySQL4Platform"/>
</properties>
<jar-file>entities.jar</jar-file>
</persistence-unit>
</persistence>

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

felix
Mike Keith
author
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.

-Mike


-Mike
Pro JPA 2: Mastering the Java Persistence API
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deploy jar with jpa Entites to Glassfish