users@glassfish.java.net

Re: Unable to retrieve EntityManagerFactory for unitName null for simple EJ

From: <glassfish_at_javadesktop.org>
Date: Mon, 28 Jun 2010 02:50:56 PDT

I've solved this problem already.
The problem was that persistence.xml file must be placed in classpath\META-INF directory, NOT in \META-INF directory of jar file.
This unobvious thing is specified in JPA specification.

Goddamn Glassfish stacktracing! It was impossible to know that persistese.xml was not found where needed looking on stacktrace. Why didn't application deploy fail?
Even more, persistence.xml was validated when deploying application (fails when there are errors in persistence.xml).
[Message sent by forum member 'nosferatum']

http://forums.java.net/jive/thread.jspa?messageID=476103