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 :

(netbeans,macosx) no declaration can be found for element 'tx:annotation-driven'


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    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
    Par défaut (netbeans,macosx) no declaration can be found for element 'tx:annotation-driven'
    environnement : macosx, spring 2.5.6, netbeans

    salut,

    je suis un tutoriel concernant netbeans, spring et jee5 (ici : http://tahe.developpez.com/java/javaee/).
    j'utilise dans un projet le fichier suivant : spring-config-dao.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
    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
     
    <?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:util="http://www.springframework.org/schema/util"
    xmlns:context="http://www.springframework.org/schema/context"
    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/util http://www.springframework.org/schema/util/spring-util.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
     <!-- couches applicatives -->
     <bean id="cotisationDao" class="dao.CotisationDao"/>
     <bean id="employeDao" class="dao.EmployeDao"/>
     <bean id="indemnitesDao" class="dao.IndemnitesDao"/>
     
     <!-- 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/jbossdb" />
    	<property name="username" value="myUserName" />
    	<property name="password" value="myPassword" />
     </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>
    *********************************************************************************************************************

    voici le 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
     
    <?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="pam-spring-hibernatePU" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
          <property name="hibernate.connection.username" value="myUserName"/>
          <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
          <property name="hibernate.connection.password" value="myPassword"/>
          <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jbossdb"/>
          <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
        </properties>
      </persistence-unit>
    </persistence>
    *********************************************************************************************************************
    et voici le message d'erreur:

    *********************************************************************************************************************
    ------------- 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: main(dao.InitDB): Caused an ERROR
    Line 44 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'.
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 44 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'.
    *********************************************************************************************************************


    la base de données est bien lancée.
    j'ai installé les jars de spring, dont spring-tx.jar.
    pouvez-vous m'aider?


    olivier.

  2. #2
    Expert confirmé
    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
    Par défaut
    Salut,

    Citation Envoyé par olivier57b Voir le message
    j'ai installé les jars de spring, dont spring-tx.jar.
    .
    Je ne peux pas trouver une autre cause pour cette erreur.
    Tu peux détailler sur le type de l'application (web, java se, etc.) et ce que tu veux dire par installé les jars de spring-tx.jar ?

  3. #3
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    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
    Par défaut
    salut,

    merci.
    en fait j'ai téléchargé la distribution de spring et j'ai ajouté tous les jars présents, donc y compris spring-tx.jar.
    il y en a sûrement trop, mais bon ça aurait dû marcher.
    mais en fait j'ai quand même l'erreur.
    y aurait-il un conflit avec un autre jar?

    tu pourrais m'aider en m'indiquant quels jars (ceux de quels répertoires) je dois inclure pour faire fonctionner une appli sous spring : quels répertoires de la distrib de spring, quels répertoires de la distrib de hibernate, et éventuellement d'autres jars nécessaires, car pour moi c'est le grand flou côté jars à inclure.

    olivier.

    NB: l'appli est une appli javaSE.

  4. #4
    Expert confirmé
    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
    Par défaut
    Salut,
    Pour Spring, dans dist/modules, prends :
    spring-aop.jar
    spring-beans.jar
    spring-context.jar
    spring-core.jar
    spring-jdbc.jar
    spring-orm.jar
    spring-tx.jar
    Pour Hibernate, ça dépend de la version. Ca fait longtemps que j'y ai pas touché, je ne peux pas trop t'aider la dessus.

    Mais de toute façon ton problème ne vient pas d'Hibernate (enfin, normalement ).

    Peux tu lister ce que t'as dans ton classpath ?

  5. #5
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    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
    Par défaut
    ok, voilà les 2 photos que j'ai faites.

  6. #6
    Membre Expert
    Homme Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 963
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 963
    Par défaut
    Dans Eclipse, il est possible de spécifier pour un schéma XML où l'IDE doit aller le chercher, par exemple localement sur le disque…

    est-ce que cela est possible dans Netbeans et si oui, est-ce que la configuration est correcte et ne renvoit pas à un fichier XSD (pour le xmlns tx) qui ne serait pas le bon ?

    (une façon bête et méchante de tester : mettez un URL farfelu pour le schéma TX si l'erreur ne change pas c'est que la validation du XML utilise un autre fichier…)

  7. #7
    Membre Expert
    Homme Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 963
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 963
    Par défaut
    le problème peut venir des schemaLocation, même si a priori il n'y a pas d'erreur dans ce que vous faites,
    essayez quand même (juste pour éliminer cette possibilité…) de spécifier explicitement le numéro de version du XSD que vous voulez, par exemple :

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

  8. #8
    Membre éprouvé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    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
    Par défaut
    après essai : possibilité éliminée.
    merci quand même.

    olivier

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

Discussions similaires

  1. Réponses: 8
    Dernier message: 27/11/2008, 19h40
  2. 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
  3. No renderer found for component
    Par babalastar dans le forum JSF
    Réponses: 1
    Dernier message: 18/12/2006, 14h19
  4. WEB SERVICE No serializer found for class
    Par lch dans le forum XML/XSL et SOAP
    Réponses: 1
    Dernier message: 14/09/2005, 16h02

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