Erreur: Un schéma ne peut pas contenir deux mondial des composants avec le même nom
Lors de la configuration d'Hibernate j'obtiens l'erreur suivante dans mon fichier de configuration.
Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.1.xsd)
Quand j'cochez la case "Plus de détails", il me donne les éléments suivants:
sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://www.springframework.org/schema/beans,identifiedType'.
J'ai un applicationContext.xml fichier dont le schéma de définition(où j'ai importer mes hibernate-context.xml fichier) est comme suit:
<?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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
..
..
<!-- Imports datasource configuration -->
<import resource="hibernate-context.xml" />
Mon hibernate-context.xml est comme suit:
<?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:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
">
C'est dans ce fichier(hibernate-context.xml) que je reçois le message d'erreur.
Mon esprit est soufflé et je suis bloqué....comment se débarrasser de cette erreur? Gentiment guide!! 🙁
- Hmmm. Votre analyseur XML semble être de se plaindre au sujet de la réelle schéma (springframework.org/schema/beans/spring-beans-3.1.xsd), qui est impair. J'aurais pensé qu'il serait valide. Je l'ai regardé rapidement et ne vois pas de problèmes évidents. Qui XML parser utilisez-vous?
- Hmm..j'utilise Eclipse comme mon IDE. Elle montre l'erreur.
Vous devez vous connecter pour publier un commentaire.
Ok, la question ai résolu. Je vais écrire ici comme une future référence pour quiconque est coincé dans le même ridicule de la situation.
J'ai modifié cette ligne de hibernate-context.xml:
à
Beats-moi pourquoi, mais il a résolu l'erreur que je recevais.
6 ans plus tard, j'ai eu le même problème lors de la mise à niveau à partir du Printemps 3.2 de Printemps 4.3.
Même si j'ai été à l'aide de Données du Printemps 1.10, je l'ai résolu en changeant de
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd