Discussion:
Location of persistence.xml
Paul Carter-Brown
2017-11-08 16:51:47 UTC
Permalink
Hi,

I have a war packaged in an ear.

In the war I have a persistence,xml in WEB-INF/ as TomEE requires it in
this location at boot in order to bootstrap the persistence providers.

This works fine.

Now my issue: if I try and
use javax.persistence.Persistence.createEntityManagerFactory("my_pu_name")
then I get an exception:

Caused by: javax.persistence.PersistenceException: No persistence providers
available for "my_pu_name" after trying the following discovered
implementations: org.apache.openjpa.persistence.PersistenceProviderImpl,
org.eclipse.persistence.jpa.PersistenceProvider


I have managed to resolve this by copying my persistence.xml into META-INF
as well as WEB-INF

Should that be necessary as it seems like a bit of a hack to me?

I'm using PLUME 7.0.4

Paul
--
This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/disclaimer>
Romain Manni-Bucau
2017-11-08 17:07:26 UTC
Permalink
Hi

WEB-INF is handled by the EE side of the server, the standalone API
(Persistence) requires to use META-INF from the classpath

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Paul Carter-Brown
Hi,
I have a war packaged in an ear.
In the war I have a persistence,xml in WEB-INF/ as TomEE requires it in
this location at boot in order to bootstrap the persistence providers.
This works fine.
Now my issue: if I try and
use javax.persistence.Persistence.createEntityManagerFactory("my_pu_name")
Caused by: javax.persistence.PersistenceException: No persistence providers
available for "my_pu_name" after trying the following discovered
implementations: org.apache.openjpa.persistence.PersistenceProviderImpl,
org.eclipse.persistence.jpa.PersistenceProvider
I have managed to resolve this by copying my persistence.xml into META-INF
as well as WEB-INF
Should that be necessary as it seems like a bit of a hack to me?
I'm using PLUME 7.0.4
Paul
--
This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/disclaimer>
Paul Carter-Brown
2017-11-09 06:37:26 UTC
Permalink
Thanks Romain.

That would explain it.
Post by Romain Manni-Bucau
Hi
WEB-INF is handled by the EE side of the server, the standalone API
(Persistence) requires to use META-INF from the classpath
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Paul Carter-Brown
Hi,
I have a war packaged in an ear.
In the war I have a persistence,xml in WEB-INF/ as TomEE requires it in
this location at boot in order to bootstrap the persistence providers.
This works fine.
Now my issue: if I try and
use javax.persistence.Persistence.createEntityManagerFactory("
my_pu_name")
Post by Paul Carter-Brown
Caused by: javax.persistence.PersistenceException: No persistence
providers
Post by Paul Carter-Brown
available for "my_pu_name" after trying the following discovered
implementations: org.apache.openjpa.persistence.PersistenceProviderImpl,
org.eclipse.persistence.jpa.PersistenceProvider
I have managed to resolve this by copying my persistence.xml into
META-INF
Post by Paul Carter-Brown
as well as WEB-INF
Should that be necessary as it seems like a bit of a hack to me?
I'm using PLUME 7.0.4
Paul
--
This email is subject to the disclaimer of Smile Communications at
http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/
disclaimer>
Loading...