But why is Tomee seeing two persistence units when there is clearly on one persistence.xml ? I don't get it.

On 01/03/2014 12:04 PM, Romain Manni-Bucau wrote:
Here what i do: put persistence.xml in web-inf only and list classes and
use exclude unlisted (set to true). Not the only way but the easier to
understand
Le 3 janv. 2014 18:28, "Kay Wrobel" <[email protected]> a écrit :

Hi everyone.

I would like some professional advice on this question. I'm using Tomee
1.6.0 Web Profile and have a working web app developed with NetBeans that
contains entity classes and sessions beans to access those entities. The
app works fine. Now I'm trying to separate these classes into a separate
class library, but I'm hitting the error wall.

First, thing that didn't work was that another class that still resides
the web app can't find the named queries anymore defined in the entity
classes. Upon reading a little about it, one suggestion was that the
persistence.xml file should be located inside the JAR file that contains
the entities, placed in the META-INF directory. After moving the
persistence.xml into the JAR as well, I now get the following deployment
errors: http://pastebin.com/fBFYaGKR

First, off it now sees two persistence units??? Even though I completely
remove the persistence.xml from the web app and placed it inside the JAR's
META-INF directory? Also the log seems to be littered with multiple
iterations of that error message per session bean. And it would be nice if
it actually told me where the "two" PUs are.

And just to clarify, after I moved the PU and the entities and session
beans to the JAR, I added the JAR project back to the web app project,
cleaned and rebuilt the JAR project first, then the web app. And then
deployed the web app.

So that's where I'm at right now, and I'm dumb-founded. Anybody know what
the best practice here is? Or is it because I'm not using Tomee FULL vs Web
Profile?

Please help. Thank you, and Happy New Year.

Kay


Reply via email to