Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: [eclipselink-users] eclipselink doesn't find my persistence.xml

The first suggestion I have for you is to colocate the persistence.xml and the classes in your persistences unit. i.e. Either put META-INF/persistence.xml in database.jar, or put the classes from database.jar in you /bin directory.

-Tom

Steffen Förster wrote:
Thanks for the answers so far. The entities are spread over many jars in /plugins.
How is your application configured?
- Java SE? Java EE(which server)?	Java SE
- Where is your persistence unit jar/directory? /bin/database.jar
- Where is your persistence.xml? /bin/META-INF
- What does your persistence.xml look like? - Are all those things on your classpath? Yes
- How are you getting the EntityManagerFactory/EntityManager? Persitence.createEntityManagerFactory(name,properties)


persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
  <persistence-unit name="sapr" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>...</class>
	...
    <class>...</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.target-database" value="Auto" />
    </properties>
  </persistence-unit>
</persistence>


-----Ursprüngliche Nachricht-----
Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Tom Ware
Gesendet: Freitag, 4. Juni 2010 17:01
An: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] eclipselink doesn't find my persistence.xml

Do you see this problem when running a simple JPA program, or just when trying to generate a cannonical model?

How is your application configured?
- JavaSE? Jave EE(which server)?
- Where is your persistence unit jar/directory?
- Where is your persistence.xml?
- What does your persistence.xml look like?
- Are all those things on your classpath?
- How are you getting the EntityManagerFactory/EntityManager?

-Tom


Steffen Förster wrote:
Hello there I'm new here.

I am using EL nightly 20100604 under jdk1.6_20. If I start my programm directly through Eclipse it works fine. When I start the jar of this programm it doesn't find the persistence.xml outside (but in the classpath).

Some more information:
PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML is set to the canonical path of the file. The file must be out of the jar, because it should be rebuilt before EL starts.

I figured out, that the PersistenceUnitProcessor calls loader.getResources(descriptorPath). It returns almost the right, but index of the CompoundEnumeration is set to 2. So EL ignores the PU entries of my file and I get a PersistenceException "No Persistence provider for EntityManager named"

Has anyone an idea what to do? Should I file a bug?


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top