Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Verifying whether eclipselink-orm.xml is being picked up

On Tue, Jun 18, 2013 at 9:11 AM, Guy Pelletier <guy.pelletier@xxxxxxxxxx> wrote:
I'm not sure exactly why your el-orm.xml is not being picked up. If it is available at runtime from META-INF/eclipselink-orm.xml it should definitely be picked up.

What I found from debugging EclipseLink is that it is only picked up if it is either a sibling of persistence.xml or in a *jar file's* META-INF directory (when the jar file is on the classpath, obviously).  It is *not* picked up if it is in a META-INF directory in another *directory* classpath root.

So in my unit/integration test area, I have (Maven users will recognize this layout):

target/classes/META-INF/eclipselink-orm.xml // I want this available if and when my jar is eventually packaged
target/test-classes/META-INF/persistence.xml // I only want this for testing

In this setup, the classpath is effectively:

target/test-classes:target/classes

...and META-INF/eclipselink-orm.xml is not loaded.  (You can see for yourself; the roots that are scanned for eclipselink-orm.xml come from (a) the place (wherever that is) where persistence.xml is found and (b) PersistenceUnitInfo#getJarFileUrls().  Obviously in this layout there are no jar file URLs to return, so only a sibling of persistence.xml is found in target/test-classes.)

Best,
Laird

--
http://about.me/lairdnelson

Back to the top