Skip to main content

[Solved] Having trouble deplying EAR. Can't resolve persistence unit...

1 reply [Last post]
Joined: 2009-02-25


I'm having a problem that should be very easy to troubleshoot, but I just can't figure it out. I must be making a stupid mistake somewhere. I've tried setting the logging to finest for, but it doesn't seem to give me any extra info.

If someone can tell me how to get verbose logging when deploying an application I can figure this out on my own. If not, my configuration is below. Are there any obvious mistakes?

I have a a very simple EAR with the following structure:

<br />
assembly-ear-1.0-SNAPSHOT.ear<br />
-- /META-INF/*<br />
-- /lib/domain-1.0-SNAPSHOT.jar           <<< POJO Module<br />
-- /lib/services-dao-api-1.0-SNAPSHOT.jar <<< POJO Module<br />
-- services-dao-1.0-SNAPSHOT.jar          <<< EJB Module<br />

I have the following persistence.xml file in the META-INF directory of the domain-1.0-SNAPSHOT.jar module:
<p>		itma-ds</p>
<p>		org.eclipse.persistence.jpa.PersistenceProvider</p>
<p>		false</p>

I try to inject the persistence unit in my EJB module like this (I've also tried it without giving a name):
<br />
@PersistenceUnit(name = "ItmaPU")<br />
private EntityManagerFactory emf;<br />

I let Maven generate my application.xml file. It looks like this:
<br />
<?xml version="1.0" encoding="UTF-8"?></p>
<p>  assembly-ejb</p>
<p>    services-dao-1.0-SNAPSHOT.jar</p>
<p>  /lib</p>

I don't have an ejb-jar.xml file.

Whenever I deploy I get the error:

<br />
Could not resolve a persistence unit corresponding to the persistence-unit-ref-name<br />
[ItmaPU] in scope of the module called<br />
[assembly-ear-1.0-SNAPSHOT#services-dao-1.0-SNAPSHOT.jar]<br />

My data source appears to be named correctly:
<br />
./asadmin list-jndi-entries<br />
...<br />
itma-ds:<br />

I'm using Glassfish v3.1 built on April 16, 2010. I updated my config from something I used with Glassfish v2, so maybe I've overlooked something that changed between versions. I haven't added / removed any modules. My database connections are working.


Message was edited by: jptech

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-02-25

Edit: I apologize for the double post with my other thread. I didn't want to leave inaccurate information in this thread.

Everything I was having trouble with was caused by a stupid, single character typo. In my Maven EAR (packaging) module I had:


instead of:


Note the leading slash. The original packaging strategy I was using with JavaEE 5 still works exactly as I want. The below blog entry of Sahoo's is what I based my packaging off of and it still works very well:

Removed a poor solution and added a better explanation.

Message was edited by: jptech

Message was edited by: jptech