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 :

Tutoriel de Serge Tahe : des soucis avec persistence.xml


Sujet :

JPA Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Juin 2010
    Messages
    47
    Détails du profil
    Informations forums :
    Inscription : Juin 2010
    Messages : 47
    Points : 39
    Points
    39
    Par défaut Tutoriel de Serge Tahe : des soucis avec persistence.xml
    Bonjour à tous
    Je suis le tutoriel de Serge Tahé:Introduction à Java EE 5, j'en suis à l'impléméntation des interfaces IEmployeDao, ICotisationDao et IIdemniteDao. Quand j'execute ma méthode de test InitDB.java j'obtiens des erreurs et j'ignore d'ou ça vient. Je ne pense pas que ça vienne de la méthode de test InitDB, j'ai plutot des inquiétudes avec persistence.xml et aussi avec l'implémentation des interfaces.
    codes:
    persistence.xml

    Code xml : 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
    <?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 -->
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>jpa.Cotisation</class>
        <class>jpa.Employe</class>
        <class>jpa.Indemnite</class>
    <properties>
       <!-- connexion JDBC -->
    <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
    <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/dbpam_hibernate" />
    <property name="hibernate.connection.username" value="dbpam" />
    <property name="hibernate.connection.password" value="dbpam" />
    <!-- création automatique du schéma -->
    <property name="hibernate.hbm2ddl.auto" value="create" />
     
    <!-- Classes persistantes -->
    <property name="hibernate.archive.autodetection" value="class, hbm" />
    </properties>
    </persistence-unit>
    </persistence>

    spring-config-dao.xml

    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
     
     <!-- couches applicatives -->
    <bean id="employeDao" class="dao.EmployeDao" />
    <bean id="indemniteDao" class="dao.IndemniteDao" />
    <bean id="cotisationDao" class="dao.CotisationDao" />
     
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="persistenceUnitName" value="jpa"/>
    <!--
    <property name="showSql" value="true" />
    -->
    <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
    <property name="generateDdl" value="true" />
    </bean>
    </property>
    <property name="loadTimeWeaver">
    <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    </property>
    </bean>
     
    <!-- la source de donnéees DBCP -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/dbpam_hibernate" />
    <property name="username" value="dbpam" />
    <property name="password" value="dbpam" />
    </bean>
     
    <!-- le gestionnaire de transactions -->
    <tx:annotation-driven transaction-manager="txManager" />
    <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>
     
    <!-- traduction des exceptions -->
    <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
     
    <!-- persistence -->
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
     
    </beans>

    EmployeDao qui implémente IEmployeDao

    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
    public class EmployeDao implements IEmployeDao{
       @PersistenceContext
       private EntityManager em;
      public void setEntityManager(EntityManager em){
          this.em=em;
      }
     
     // créer une nouvelle entité Employe
     public Employe create(Employe employe){
         em.persist(employe);
         return  employe;
     }
    // modifier une entité Employe existante
     public Employe edit(Employe employe) {
     return em.merge(employe);
        }
     // supprimer une entité Employe
     public void destroy(Employe employe) {
         if (employe == null) {
          throw new PamException(2);
           }
               em.remove(employe);
        }
    // chercher une entité Employe via son identifiant id
     public Employe find(Long id) {
            return em.find(Employe.class, id);
        }
       // chercher une entité Employe via son n° SS
     public Employe find(String SS) {
             return em.find(Employe.class, SS);
        }
     @SuppressWarnings("unchecked")
       // obtenir toutes les entités
     public List<Employe> findAll() {
            return em.createQuery("select e from Employe e").getResultList();
        }
    }
    IEmployeDao

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    public interface IEmployeDao {
     // créer une nouvelle entité Employe
     public Employe create(Employe employe);
     // modifier une entité Employe existante
     public Employe edit(Employe employe);
     // supprimer une entité Employe
     public void destroy(Employe employe);
     // chercher une entité Employe via son identifiant id
     public Employe find(Long id);
     // chercher une entité Employe via son n° SS
     public Employe find(String SS);
     // obtenir toutes les entités Employe
     public List<Employe> findAll();
     }
    InitDB.java

    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
    52
    53
    54
     public class InitDB {
      @PersistenceContext
      static  private EntityManager em;
      static private IEmployeDao employeDao = null;
      static  private ICotisationDao cotisationDao = null;
      static private IIndemniteDao indemniteDao = null;
     
     @BeforeClass
     public static void init(){
     // configuration de l'application
     ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config-dao.xml");
    // couches dao49014,1
     employeDao = (IEmployeDao) ctx.getBean("employeDao");
     cotisationDao = (ICotisationDao) ctx.getBean("cotisationDao");
     indemniteDao = (IIndemniteDao) ctx.getBean("indemniteDao");
     }
    @Test
     public void initDB(){
     // on remplit la base
    Indemnite indemnite1=indemniteDao.create(new Indemnite(1,1.93,2,3,12));
     Indemnite indemnite2=indemniteDao.create(new Indemnite(2,2.1,2.1,3.1,15));
     Employe employe2=employeDao.create(new Employe("254104940426058","Jouveinal","Marie","5 rue des oiseaux","St Corentin","49203",indemnite2));
     Employe employe1=employeDao.create(new Employe("260124402111742","Laverti","Justine","La brûlerie","St Marcel","49014",indemnite1));
     Cotisation cotisation1=cotisationDao.create(new Cotisation(3.49,6.15,9.39,7.88));
     
     // on affiche le contenu de la base
     System.out.format("[Employes]%n");
     for (Object emp : em.createQuery("select e from Employe e").getResultList()) {
     System.out.println(emp);
     }
     System.out.format("[Indemnites]%n");
     for (Object ind : em.createQuery("select i from Indemnite i").getResultList()) {
     System.out.println(ind);
     }
     System.out.format("[Cotisations]%n");
    for (Object cot : em.createQuery("select c from Cotisation c").getResultList()) {
     System.out.println(cot);
     }
     }
     
     @Before()
     public  void clean(){
     // on vide la base
     for(Employe employe:employeDao.findAll()){
     employeDao.destroy(employe);
     }
     for(Cotisation cotisation:cotisationDao.findAll()){
     cotisationDao.destroy(cotisation);
     }
     for(Indemnite indemnite : indemniteDao.findAll()){
     indemniteDao.destroy(indemnite);
     }
     }
     }
    Merci de votre aide
    Coulane

  2. #2
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Peut on voir tes traces d'erreur?
    Vous avez peut être hâte de réussir et il n'y a rien de mal à cela...
    mais la patience est aussi une vertu; l'échec vous l'enseignera certainement..."

  3. #3
    Nouveau membre du Club
    Inscrit en
    Juin 2010
    Messages
    47
    Détails du profil
    Informations forums :
    Inscription : Juin 2010
    Messages : 47
    Points : 39
    Points
    39
    Par défaut
    Voilà ce que j'obtiens:

    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    Testsuite: dao.InitDB
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    Tests run: 0, Failures: 0, Errors: 1, Time elapsed: 0,597 sec
     
    ------------- Standard Error -----------------
    log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
    log4j:WARN Please initialize the log4j system properly.
    ------------- ---------------- ---------------
    Testcase: dao.InitDB:        Caused an ERROR
    Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring-config-dao.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'persistenceUnitName' of bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: No property 'persistenceUnitName' found
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring-config-dao.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'persistenceUnitName' of bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: No property 'persistenceUnitName' found
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
            at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
            at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
            at dao.InitDB.init(InitDB.java:35)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring-config-dao.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'persistenceUnitName' of bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: No property 'persistenceUnitName' found
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:117)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
            at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:270)
            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:122)
            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:78)
            at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
            at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:97)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1325)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#5a9de6' defined in class path resource [spring-config-dao.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'persistenceUnitName' of bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: No property 'persistenceUnitName' found
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219)
    Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'persistenceUnitName' of bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: No property 'persistenceUnitName' found
            at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:382)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1288)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1249)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
     
     
    Test dao.InitDB FAILED
    test:
    Deleting: C:\Users\USER\AppData\Local\Temp\TEST-dao.InitDB.xml
    GÉNÉRATION TERMINÉE (durée totale* 4 secondes)

  4. #4
    Membre confirmé
    Avatar de Khaled.Noordin
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    354
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 354
    Points : 497
    Points
    497
    Billets dans le blog
    1
    Par défaut
    salut
    Met en commentaire la ligne 17 du fichier spring-config-dao.xml, et test ton code.
    Cordialement Khaled.Noordin


    Ps: ta question relève de spring et pas jpa

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    68
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 68
    Points : 116
    Points
    116
    Par défaut
    @coulane
    c'est quoi le lien du tutoriel svp

  6. #6
    Nouveau membre du Club
    Inscrit en
    Juin 2010
    Messages
    47
    Détails du profil
    Informations forums :
    Inscription : Juin 2010
    Messages : 47
    Points : 39
    Points
    39
    Par défaut
    Bonjour
    Merci khaled.Noordin, j'ai commenté la ligne 17 mais j'obtient toujours 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
    Testcase: dao.InitDB:        Caused an ERROR
    Line 27 in XML document from class path resource [spring-config-dao.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'property'. One of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":meta, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/beans":ref, "http://www.springframework.org/schema/beans":idref, "http://www.springframework.org/schema/beans":value, "http://www.springframework.org/schema/beans":null, "http://www.springframework.org/schema/beans":list, "http://www.springframework.org/schema/beans":set, "http://www.springframework.org/schema/beans":map, "http://www.springframework.org/schema/beans":props, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 27 in XML document from class path resource [spring-config-dao.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'property'. One of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":meta, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/beans":ref, "http://www.springframework.org/schema/beans":idref, "http://www.springframework.org/schema/beans":value, "http://www.springframework.org/schema/beans":null, "http://www.springframework.org/schema/beans":list, "http://www.springframework.org/schema/beans":set, "http://www.springframework.org/schema/beans":map, "http://www.springframework.org/schema/beans":props, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
            at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
            at dao.InitDB.init(InitDB.java:35)
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'property'. One of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":meta, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/beans":ref, "http://www.springframework.org/schema/beans":idref, "http://www.springframework.org/schema/beans":value, "http://www.springframework.org/schema/beans":null, "http://www.springframework.org/schema/beans":list, "http://www.springframework.org/schema/beans":set, "http://www.springframework.org/schema/beans":map, "http://www.springframework.org/schema/beans":props, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3181)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1805)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:725)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
            at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
            at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
            at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
     
     
    Test dao.InitDB FAILED
    la ligne 27 est la suivante:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="persistenceUnitName" value="jpa"/>
    je l'ai aussi commenté mais j'obtiens une autre erreur.

    Pour Jojo K-ri voila le lien:
    http://tahe.developpez.com/java/javaee/
    coulane.

  7. #7
    Membre confirmé
    Avatar de Khaled.Noordin
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    354
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 354
    Points : 497
    Points
    497
    Billets dans le blog
    1
    Par défaut
    Salut
    en regardant la ligne 16 du meme fichier dont je parlais ta balise property ne se ferme jamais.
    il faudrait avoir à la place
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="jpaVendorAdapter" ref="mon_jpaVendorAdapter"/>

    pour cela comme tu avais cherché à le faire créer un bean dans ton fichier spring tel que :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <bean id="mon_jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="showSql" value="false" />
    <property name="generateDdl" value="true" />
    <property name="database" value="MYSQL" />
    </bean>

  8. #8
    Nouveau membre du Club
    Inscrit en
    Juin 2010
    Messages
    47
    Détails du profil
    Informations forums :
    Inscription : Juin 2010
    Messages : 47
    Points : 39
    Points
    39
    Par défaut
    La balise 16 est bien fermée par la balise 25.
    Coulane.

Discussions similaires

  1. Réponses: 3
    Dernier message: 17/07/2014, 09h43
  2. [CognosScript] Encore des soucis avec une connexion ODBC
    Par ben_harper dans le forum Cognos
    Réponses: 1
    Dernier message: 23/06/2009, 19h08
  3. Des soucis avec mon application Excel sur les contacts
    Par diddle dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 27/11/2007, 19h50
  4. J'ai des soucis avec Delphi8 ShellExecute...
    Par manu00 dans le forum Delphi .NET
    Réponses: 6
    Dernier message: 25/07/2004, 08h38

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