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

Spring Java Discussion :

The matching wildcard is strict, but no declaration can be found for element 'tx:anno


Sujet :

Spring Java

  1. #1
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut The matching wildcard is strict, but no declaration can be found for element 'tx:anno
    bonjour,

    je lis actuellement un tuto de S.Tahé (du site developpez.com) sur J2EE, et je rencontre une erreur avec un des programmes, voici l'erreur:

    FAILED CONFIGURATION: @BeforeClass init
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 54 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.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'.
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
    at dao.InitDB.init(InitDB.java:37)
    ... Removed 22 stack frames
    SKIPPED CONFIGURATION: @BeforeMethod clean
    SKIPPED: initDB
    elle se produit lors de l'exécution d'une classe initDB, dont voici un extrait:

    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
     
    public class InitDB {
     
        @PersistenceContext
        private EntityManager em;
        private IEmployéDao employeDao = null;
        private ICotisationDao cotisationDao = null;
        private IIndemnitéDao indemniteDao = null;
     
        @BeforeClass
        public void init() {
            // configuration de l'application
            ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config-dao.xml");
            // couches dao
            employeDao = (IEmployéDao) ctx.getBean("employéDao");
            cotisationDao = (ICotisationDao) ctx.getBean("cotisationDao");
            indemniteDao = (IIndemnitéDao) ctx.getBean("indemnitéDao");
        }
     
        @Test
        public void initDB() {
     
            // on remplit la base
            indemnité une_ind=new indemnité(0, 0, 2.38, 1.03, 15.0, 5.0);
            indemnité deux_ind=new indemnité(0,0,1.43, 2.0, 10.0, 7.0);
            indemniteDao.create(une_ind);
            indemniteDao.create(deux_ind);
            employé un_employé=new employé("174075746304472", "SAINT-EVE", "Olivier", 57050, "12 impasse des genêts", "metz", une_ind);
            employeDao.create(un_employé);
            cotisation une_cot=new cotisation(1.3, 2.7, 2.1, 1.0);
            cotisationDao.create(une_cot);
     
     
            // on affiche le contenu de la base
            System.out.println("*** AFFICHAGE DU CONTENU DE JPA2 ***");
            System.out.println("*** TABLE indemnité              ***");
            for (Object ind : em.createQuery("select i from indemnité i").getResultList()) {
                System.out.println(ind);
            }
            System.out.println("*** TABLE cotisation              ***");
            for (Object cot : em.createQuery("select c from cotisation c").getResultList()) {
                System.out.println(cot);
            }
            System.out.println("*** TABLE employé              ***");
            for (Object emp : em.createQuery("select e from employé e").getResultList()) {
                System.out.println(emp);
            }
     }

    et le fichier où se trouve l'erreur est le fichier de configuration de spring:

    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
    68
    69
    70
     
    <?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-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-
    2.0.xsd">
     
     <!-- couches applicatives -->
     <bean id="dao" class="dao.Dao" />
     <bean id="service" class="service.Service">
        <property name="dao" ref="dao" />
     </bean>
     
     <bean id="employéDao" class="intro_j2ee.dao.employé_dao" />
     <bean id="cotisationDao" class="intro_j2ee.dao.cotisation_dao" />
     <bean id="indemnitéDao" class="intro_j2ee.dao.indemnité_dao" />
     
     
     
     <!-- couche de persistance JPA -->
     <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="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/jpa2" />
     <property name="username" value="jpa2" />
     <property name="password" value="jpa2" />
     </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" />
     
     <!-- annotations de persistance -->
     <bean
     class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
     
     </beans>
    netbeans n'aime pas l'annotation "<tx:annotation-driven ..."... mais je ne comprends pas pourquoi.

    lolveley.

  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
    Salut,
    Dans cetet partie :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"

    vires les "-2.0" :

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    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"

  3. #3
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    merci de ta réponse, j'ai modifié le fichier spring-config-dao.xml mais j'obtiens alors le message suivant:

    FAILED CONFIGURATION: @BeforeClass init
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 53 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.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'.
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'.
    lolveley.

  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
    Est ce que t'as ajouté spring-tx.jar au build path ?

  5. #5
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    que nenni, je m'y emploie tout de suite.

    je te renseignerai sur le résultat dès que possible.

    lolveley.

  6. #6
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    eh bien je suis perdu, je n'arrive pas à trouver le fichier spring-tx.jar, à la base avec netbeans j'ai utilisé un fichier .NBM pour installer le plugin spring, et sur le site de spring j'ai téléchargé la dernière version de spring (2.5.5) et j'ai fait une recherche sur les répertoires décompressés, mais sans résultat.

    pourrais-tu me dire où trouver ce fichier?

    lolveley.

  7. #7
    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
    Citation Envoyé par olivier57b Voir le message
    eh bien je suis perdu, je n'arrive pas à trouver le fichier spring-tx.jar, à la base avec netbeans j'ai utilisé un fichier .NBM pour installer le plugin spring, et sur le site de spring j'ai téléchargé la dernière version de spring (2.5.5) et j'ai fait une recherche sur les répertoires décompressés, mais sans résultat.

    pourrais-tu me dire où trouver ce fichier?

    lolveley.
    Dans le dossier "spring-framework-2.5.*/dist/modules"

    (Et la dernière version est 2.5.6 pas 2.5.5)

  8. #8
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    euh, oui, c'est la 2.5.6; pour le jar j'ai mal utilisé la fonction rechercher de vista...

    j'essaie tout de suite.

    lolveley.

  9. #9
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    Ca ne marche toujours pas, j'ai inclus le fichier jar (il se retrouve dans dist/lib) mais j'obtiens toujours la même erreur.

    peut-être que le fichier spring-tx n'est pas de la même version que le reste de spring?

    qu'en penses-tu?

    lolveley.

Discussions similaires

  1. Réponses: 5
    Dernier message: 16/11/2009, 00h54
  2. [SAX] Erreur parsing SAX: The entity "lg" was referenced, but not declared.
    Par nouknouk dans le forum Format d'échange (XML, JSON...)
    Réponses: 1
    Dernier message: 12/10/2009, 13h24
  3. Réponses: 9
    Dernier message: 26/09/2009, 22h18
  4. Réponses: 0
    Dernier message: 09/10/2008, 18h40
  5. Concatenation a l'interieur de la declaration d'une boucle for
    Par Benjamin2tours dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 10/04/2007, 10h28

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