IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JPA Java Discussion :

[TopLink]erreur "No Persistence Provider for Entity Manager"


Sujet :

JPA Java

  1. #1
    Membre éclairé Avatar de bassim
    Homme Profil pro
    Ingénieur Réseaux
    Inscrit en
    Février 2005
    Messages
    666
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur Réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Février 2005
    Messages : 666
    Points : 695
    Points
    695
    Par défaut [TopLink]erreur "No Persistence Provider for Entity Manager"
    Bonjour,
    j'essaye d'utiliser JPA/Toplink pour le mapping O/R, mais j'ai l'erreur suivante:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named jpa: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: 
    oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
    Local Exception Stack: 
    Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
    Internal Exception: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [jpa] failed.
    Internal Exception: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be cast to java.lang.Class
            at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
            at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
            at DAO.Dao.init(Dao.java:34)
            at Main.Lancement.main(Lancement.java:29)
    Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [jpa] failed.
    Internal Exception: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be cast to java.lang.Class
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:643)
            at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:171)
            at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:239)
            at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
            at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
            ... 4 more
    Caused by: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
    Exception Description: predeploy for PersistenceUnit [jpa] failed.
    Internal Exception: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be cast to java.lang.Class
            at oracle.toplink.essentials.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:228)
            ... 9 more
    Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl cannot be cast to java.lang.Class
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataHelper.getReturnTypeFromGeneric(MetadataHelper.java:603)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject.getReferenceClassFromGeneric(MetadataAccessibleObject.java:141)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.CollectionAccessor.getReferenceClass(CollectionAccessor.java:175)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:287)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:579)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:512)
            at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:246)
            at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:370)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:607)
            ... 8 more
     
     
     The following providers:
    oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    Returned null to createEntityManagerFactory.
     
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
            at DAO.Dao.init(Dao.java:34)
            at Main.Lancement.main(Lancement.java:29)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 11 seconds)
    et voici mon fichier persistence.xml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    <?xml version="1.0" encoding="UTF-8"?>
    <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="jpa" transaction-type="RESOURCE_LOCAL">
        <provider>oracle.toplink.essentials.PersistenceProvider</provider>
        <class>Metier.Enseignant.Enseignant</class>
        <class>Metier.Etudes.Discipline</class>
        <class>Metier.Etudes.Domaine</class>
        <class>Metier.Etudes.Module</class>
        <class>Metier.Etudes.UE</class>
        <class>Metier.Etudiant.Cursus</class>
        <class>Metier.Etudiant.Etats.AbstractEtatEtudiant</class>
        <class>Metier.Etudiant.Etudiant</class>
        <class>Metier.Notes.ReleveNotes</class>
        <class>Metier.Promotion.ASemestre</class>
        <class>Metier.Promotion.Annee</class>
        <class>Metier.Promotion.Cours</class>
        <class>Metier.Promotion.Epreuve</class>
        <class>Metier.Promotion.Etats.AbstractEtatPromotion</class>
        <class>Metier.Promotion.EtatsAnnee.AbstractEtatAnnee</class>
        <class>Metier.Promotion.EtatsSemestre.AbstractEtatSemestre</class>
        <class>Metier.Promotion.Promotion</class>
        <class>Metier.Promotion.Regles</class>
        <class>Metier.Promotion.Semestre</class>
        <properties>
          <property name="toplink.jdbc.user" value=""/>
          <property name="toplink.jdbc.password" value=""/>
          <property name="toplink.jdbc.url" value="jdbc:derby://localhost:1527/JStudentDB"/>
          <property name="toplink.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
          <property name="toplink.ddl-generation" value="create-tables"/>
        </properties>
      </persistence-unit>
    </persistence>
    le code qui me permet de créer un EntityMAnager:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    public void init(){
            System.out.println("init() ...");
            fabrique = Persistence.createEntityManagerFactory("jpa");
            contextePersistance = fabrique.createEntityManager();
            System.out.println("Fabrique ="+fabrique);
            System.out.println("contexte ="+contextePersistance);
            getDaoEtudiant();
            getDaoEnseignant();
            getDaoPromotion();
        }
    j'ai bien mis les différentes librairies dans le class-path (META-INF aussi qui contient persistence.xml)

    J'ai beau cherché sur Google/developpez, j'ai rien trouvé

  2. #2
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    Bonjour.
    Veux tu s'il te plaît faire le test suivant:
    Enlever tous les éléments <class> du fichier persistence.xml et retester ?
    Tiens nous au courant.


    P.S.: Les conventions de nommage Java préconisent des noms de package en miniscules.

  3. #3
    Membre éclairé Avatar de bassim
    Homme Profil pro
    Ingénieur Réseaux
    Inscrit en
    Février 2005
    Messages
    666
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur Réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Février 2005
    Messages : 666
    Points : 695
    Points
    695
    Par défaut
    Citation Envoyé par djo.mos Voir le message
    Bonjour.
    Veux tu s'il te plaît faire le test suivant:
    Enlever tous les éléments <class> du fichier persistence.xml et retester ?
    Tiens nous au courant.


    P.S.: Les conventions de nommage Java préconisent des noms de package en miniscules.
    effectivement, l'erreur n'est plus la même
    penses tu que les majuscules soit en tort ?
    voici la nouvelle erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    Exception in thread "main" Local Exception Stack: 
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLTransientConnectionException: La longueur de l'ID utilisateur (0) se situe hors de l'intervalle de 1 à 255.
    Error Code: 40000
            at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
            at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:102)
            at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
            at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
            at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
            at DAO.Dao.init(Dao.java:35)
            at Main.Lancement.main(Lancement.java:29)
    Caused by: java.sql.SQLTransientConnectionException: La longueur de l'ID utilisateur (0) se situe hors de l'intervalle de 1 à 255.
            at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
            at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
            at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
            at java.sql.DriverManager.getConnection(DriverManager.java:582)
            at java.sql.DriverManager.getConnection(DriverManager.java:154)
            at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:100)
            ... 10 more
    Caused by: org.apache.derby.client.am.SqlException: La longueur de l'ID utilisateur (0) se situe hors de l'intervalle de 1 à 255.
            at org.apache.derby.client.net.NetConnection.checkUserLength(Unknown Source)
            at org.apache.derby.client.net.NetConnection.checkUser(Unknown Source)
            at org.apache.derby.client.net.NetConnection.checkUserPassword(Unknown Source)
            at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
            at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
            at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
            at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown Source)
            ... 14 more
    Java Result: 1
    BUILD SUCCESSFUL (total time: 14 seconds)
    apparemment je dois définir un compte différent d'une chaine vide !

  4. #4
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    Exact.
    Je n'ai jamais utilisé Derby avant, et je ne connais pas le nom d'utilisateur par défaut (sa dans hsqldb, root dans 99% des autres, etc.).
    En tout cas, le pilote JDBC de Derby n'accèpte pas un nom d'utilisateur vide. Documente toi sur la chose et retestes.

    @+

  5. #5
    Membre éclairé Avatar de bassim
    Homme Profil pro
    Ingénieur Réseaux
    Inscrit en
    Février 2005
    Messages
    666
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur Réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Février 2005
    Messages : 666
    Points : 695
    Points
    695
    Par défaut
    Bon, le premier problème est résolu !
    Ce n'est pas les majuscules qui étaient en cause, mais des erreurs au niveau du schéma objet.

    merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 13/11/2014, 14h14
  2. Réponses: 2
    Dernier message: 07/11/2014, 13h27
  3. Réponses: 3
    Dernier message: 26/02/2014, 17h07
  4. Réponses: 1
    Dernier message: 16/05/2012, 12h55
  5. [Toplink] No Persistence provider for EntityManager
    Par seb974 dans le forum Persistance des données
    Réponses: 1
    Dernier message: 21/03/2009, 20h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo