Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Exception [EclipseLink-30005] - Persistence FAILED
Exception [EclipseLink-30005] - Persistence FAILED [message #381265] Fri, 05 September 2008 17:05 Go to next message
Eclipse UserFriend
Originally posted by: www.floranet.eu.gmail.com

Hi there to everyone,
i start a eclipselink study but i get this issue all the times.
In my classpath i got a user librarie with
(eclipselink.jar,javax.persistence_1.0.0.0.jar,
mysql-connector-java-5.1.6). I configure my persistence.xml like this:

<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="eu.floranet.jpa.link"
transaction-type="RESOURCE_LOCAL">
<description>org.eclipse.persistence.jpa.PersistenceProvider,
javax.persistence.Persistence</description>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >

<class>
eu.link.temp.CptExposicao</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>

<properties>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="eclipselink.jdbc.driver"
value="com.mysql.jdbc.Driver"/>
<property name="eclipselink.jdbc.url"
value="jdbc:mysql://server:3306/database"/>
<property name="eclipselink.jdbc.password" value="pass"/>
<property name="eclipselink.jdbc.user" value="user"/>

<property name="eclipselink.jdbc.read-connections.min" value="1"/>
<property name="eclipselink.jdbc.write-connections.min" value="1"/>
<property name="eclipselink.target-database" value="MySql"/>

</properties>
</persistence-unit>
</persistence>

And got this error in console:

Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.RuntimeException:
java.lang.NullPointerException
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0 (Build
1.0 - 20080707)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.RuntimeException:
java.lang.NullPointerException
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:121)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:117)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:64)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:60)
at eu.link.temp.MainExpo.createEMF(MainExpo.java:26)
at eu.link.temp.MainExpo.start(MainExpo.java:36)
at eu.link.temp.MainExpo.main(MainExpo.java:20)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:67)
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:105)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProces sor.loadStandardMappingFiles(MetadataProcessor.java:343)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProces sor.loadMappingFiles(MetadataProcessor.java:271)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.buildPersistentClassSetFromXMLDocuments(Persist enceUnitProcessor.java:127)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.buildClassSet(PersistenceUnitProcessor.java:90)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.callPredeploy(JPAInitializer.java:83)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initPersistenceUnits(JPAInitializer.java:149)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initialize(JPAInitializer.java:135)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:104)
... 6 more
Caused by: java.lang.NullPointerException
at
org.eclipse.persistence.platform.xml.XMLPlatformFactory.getX MLPlatformClass(XMLPlatformFactory.java:75)
at
org.eclipse.persistence.platform.xml.XMLPlatformFactory.getX MLPlatform(XMLPlatformFactory.java:106)
at
org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller. <init>(DOMUnmarshaller.java:65)
at
org.eclipse.persistence.oxm.platform.DOMPlatform.newPlatform Unmarshaller(DOMPlatform.java:38)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.initialize(XMLUn marshaller.java:84)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.<init>(XMLUnmarshaller.java:78)
at
org.eclipse.persistence.oxm.XMLContext.createUnmarshaller(XM LContext.java:271)
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:63)
... 15 more
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0 (Build
1.0 - 20080707)):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: java.lang.RuntimeException:
java.lang.NullPointerException
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:121)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:117)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:64)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:83)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:60)
at eu.link.temp.MainExpo.createEMF(MainExpo.java:26)
at eu.link.temp.MainExpo.start(MainExpo.java:36)
at eu.link.temp.MainExpo.main(MainExpo.java:20)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:67)
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:105)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProces sor.loadStandardMappingFiles(MetadataProcessor.java:343)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProces sor.loadMappingFiles(MetadataProcessor.java:271)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.buildPersistentClassSetFromXMLDocuments(Persist enceUnitProcessor.java:127)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceU nitProcessor.buildClassSet(PersistenceUnitProcessor.java:90)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.callPredeploy(JPAInitializer.java:83)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initPersistenceUnits(JPAInitializer.java:149)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializ er.initialize(JPAInitializer.java:135)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:104)
... 6 more
Caused by: java.lang.NullPointerException
at
org.eclipse.persistence.platform.xml.XMLPlatformFactory.getX MLPlatformClass(XMLPlatformFactory.java:75)
at
org.eclipse.persistence.platform.xml.XMLPlatformFactory.getX MLPlatform(XMLPlatformFactory.java:106)
at
org.eclipse.persistence.internal.oxm.record.DOMUnmarshaller. <init>(DOMUnmarshaller.java:65)
at
org.eclipse.persistence.oxm.platform.DOMPlatform.newPlatform Unmarshaller(DOMPlatform.java:38)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.initialize(XMLUn marshaller.java:84)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.<init>(XMLUnmarshaller.java:78)
at
org.eclipse.persistence.oxm.XMLContext.createUnmarshaller(XM LContext.java:271)
at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityM appingsReader.read(XMLEntityMappingsReader.java:63)
... 15 more

If i change the provider to javax.persistence.Persistence other
different issue i got:

javax.persistence.PersistenceException: No Persistence provider for
EntityManager named eu.floranet.jpa.link
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:89)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:60)
at eu.link.temp.MainExpo.createEMF(MainExpo.java:26)
at eu.link.temp.MainExpo.start(MainExpo.java:36)
at eu.link.temp.MainExpo.main(MainExpo.java:20)
Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for EntityManager named eu.floranet.jpa.link
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:89)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:60)
at eu.link.temp.MainExpo.createEMF(MainExpo.java:26)
at eu.link.temp.MainExpo.start(MainExpo.java:36)
at eu.link.temp.MainExpo.main(MainExpo.java:20)

Could someone help me?
Thanks in advance....
Re: Exception [EclipseLink-30005] - Persistence FAILED [message #381266 is a reply to message #381265] Fri, 05 September 2008 18:15 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Miguel,

Please ensure your persistence.xml file is located at:
META-INF/persistence.xml on your classpath. Can you also provide any
details of how your are initiating your JPA access?

Doug
Re: Exception [EclipseLink-30005] - Persistence FAILED [message #381271 is a reply to message #381266] Mon, 08 September 2008 08:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: www.floranet.eu.gmail.com

Doug Clarke escreveu:
> Miguel,
>
> Please ensure your persistence.xml file is located at:
> META-INF/persistence.xml on your classpath. Can you also provide any
> details of how your are initiating your JPA access?
>
> Doug
>
Hi Doug,
the persistence file is located at META-INF and the file contain this code:

package eu.flora.temp;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class MainP {

private EntityManagerFactory emf;

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
MainP p = new MainP();
p.start();
}

private EntityManagerFactory createEMF() {
try {
return Persistence.createEntityManagerFactory("PLink");
} catch (RuntimeException e) {
System.out.println("Persistence.createEMF FAILED: "
+ e.getMessage());
e.printStackTrace();
throw e;
}
}

public void start(){
this.emf = this.createEMF();
EntityManager em = this.emf.createEntityManager();

CptEntidades c = em.find(CptEntidades.class, 1);
System.out.println("Name: " + c.getEntidadeNome());
em.close();
}
}
Re: Exception [EclipseLink-30005] - Persistence FAILED [message #381272 is a reply to message #381271] Mon, 08 September 2008 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: www.floranet.eu.gmail.com

Miguel Ramos escreveu:
> Doug Clarke escreveu:
>> Miguel,
>>
>> Please ensure your persistence.xml file is located at:
>> META-INF/persistence.xml on your classpath. Can you also provide any
>> details of how your are initiating your JPA access?
>>
>> Doug
>>
> Hi Doug,
> the persistence file is located at META-INF and the file contain this code:
>
> package eu.flora.temp;
>
> import javax.persistence.EntityManager;
> import javax.persistence.EntityManagerFactory;
> import javax.persistence.Persistence;
>
> public class MainP {
>
> private EntityManagerFactory emf;
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> MainP p = new MainP();
> p.start();
> }
>
> private EntityManagerFactory createEMF() {
> try {
> return Persistence.createEntityManagerFactory("PLink");
> } catch (RuntimeException e) {
> System.out.println("Persistence.createEMF FAILED: "
> + e.getMessage());
> e.printStackTrace();
> throw e;
> }
> }
>
> public void start(){
> this.emf = this.createEMF();
> EntityManager em = this.emf.createEntityManager();
>
> CptEntidades c = em.find(CptEntidades.class, 1);
> System.out.println("Name: " + c.getEntidadeNome());
> em.close();
> }
> }

After analyse the eclipselink.jar and read some articles i applied the
osgi bundles and after that everything works fine. I've just create a
USER_LIBRARIE with the jars bundled by osgi and change the provider in
the persistence.xml by org.eclipse.persistence.jpa.PersistenceProvider.
Re: Exception [EclipseLink-30005] - Persistence FAILED [message #381274 is a reply to message #381271] Mon, 08 September 2008 13:59 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
This is odd, the null-pointer you are seeing is occurring because the
EclipseLink class loader is null. From the java.lang.Class comment this
can only occur on some JVMs if the bootstrap loader was used to load the
class.

How are you launching your Java program, and what JVM are you using (and
what are your JVM args)?

-- James
Re: Exception [EclipseLink-30005] - Persistence FAILED [message #381275 is a reply to message #381274] Mon, 08 September 2008 14:12 Go to previous message
Eclipse UserFriend
Originally posted by: www.floranet.eu.gmail.com

James escreveu:
> This is odd, the null-pointer you are seeing is occurring because the
> EclipseLink class loader is null. From the java.lang.Class comment this
> can only occur on some JVMs if the bootstrap loader was used to load the
> class.
>
> How are you launching your Java program, and what JVM are you using (and
> what are your JVM args)?
>
> -- James
>
>
I use jdk1.6.0_03 and launch from eclipse with default args, and you
where right about the null-pointer. The fact of using a user librarie in
eclipse the class's aren't load and occur the class loader null. I just
link the jars in jlib of eclipselink (not using USER_LIBRARIE) and
voilâ.... Working.

THanks,
Previous Topic:NPE running JPA with Spring 2.5 & Tomcat 5
Next Topic:TRIM in JPA NamedQuery
Goto Forum:
  


Current Time: Sat Dec 20 19:38:28 GMT 2014

Powered by FUDForum. Page generated in 0.02373 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software