Skip to main content

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

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

Hi,

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 javax.enterprise.system.tools.deployment, 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>
<p>		itma-ds</p>
<p>		org.eclipse.persistence.jpa.PersistenceProvider</p>
<p>		false</p>
<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>
<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: org.glassfish.javaee.services.ResourceProxy<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.

Solved

Message was edited by: jptech

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jptech
Offline
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:

[code]/lib[/code]

instead of:

[code]lib[/code]

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:

http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html

Removed a poor solution and added a better explanation.

Message was edited by: jptech

Message was edited by: jptech