I found that NetBeans, on deployment, copied the persistence.xml file
into the another location. I removed the Netbeans cache from my home
directory and it stopped doing that.
That said, a new issue arose. Apparently, the auto-generated Entity
classes are not being generated anymore (the ones that end in an
underscore).
So maybe my approach as a whole is not what should be done. I read up a
little, and what would more appropriate would be to create Java EE
Enterprise module, into which I would then create sub-projects for a WAR
and an EJB (containing entities and session beans). These would then be
packaged to an EAR. But how to do that with Tomee and Netbeans goes
beyond the scope of my question and Netbeans doesn't properly support
Tomee yet, meaning I can't create such a project because it only gives
my Glassfish as a choice. Bummer!
But, from a Tomee perspective, does it support the concept of bundled
WAR/EJB in EARs?
On 01/03/2014 03:30 PM, Romain Manni-Bucau wrote:
if you can reproduce it share your app but tomee has good glasses normally ;)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014/1/3 Kay Wrobel <[email protected]>:
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