STS + gwt + fichiers spring-config + tx: espace de noms d'annotation
-
13-11-2019 - |
Question
Je suis coincé là-dessus depuis un moment.J'ai développé un projet Java backend gwt + spring.Mon projet est structuré avec un projet GWT et un autre projet Java pour les services Spring, etc.Chaque projet contient ses fichiers spring-config respectifs.en essayant de charger les configurations de printemps si je devais utilisertx:annotation-driven
je reçois continuellement ce qui suit.org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'.
je dois mentionner que je déploie dans le conteneur gwt à l'intérieur de sts en utilisant le plugin Google pour Eclipse.
mon espace de noms spring-servlet commence ainsi
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="h ttp://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="h ttp://www.springframework.org/schema/aop"
xmlns:context="h ttp://www.springframework.org/schema/context"
xmlns:p="h ttp://www.springframework.org/schema/p"
xmlns:util="h ttp://www.springframework.org/schema/util"
xmlns:tx="h ttp://www.springframework.org/schema/tx"
xsi:schemaLocation="h ttp://www.springframework.org/schema/aop h ttp://www.springframework.org/schema/aop/spring-aop-3.0.xsd
h ttp://www.springframework.org/schema/beans h ttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
h ttp://www.springframework.org/schema/util h ttp://www.springframework.org/schema/util/spring-util-3.0.xsd
h ttp://www.springframework.org/schema/tx h ttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd
h ttp://www.springframework.org/schema/context h ttp://www.springframework.org/schema/context/spring-context-3.0.xsd">
<tx:annotation-driven transaction-manager="transactionManager"/>
J'ai parcouru de nombreux posts pour le comprendre mais je n'ai pas réussi à résoudre le problème.a) J'ai essayé d'importer le schéma dans le catalogue XML en utilisant:jar:file:path/to/spring-framework-3.0.5.RELEASE/dist/org.springframework.transaction-3.0.5.RELEASE.jar!/org/springframework/transaction/config/spring-tx-3.0.xsd
avec clé comme http://www.springframework.org/schema/context/spring-context-3.0.xsd
et tapez comme emplacement du schéma.
J'apprécie toute aide ou pointeur !
La solution
Pour ceux qui sont confrontés à des problèmes similaires dans un environnement incluant STS et maven.Assurez-vous d'avoir ajouté le bon fichier jar à votre pom.xml, puis mettez à jour vos dépendances ;rafraîchissez votre espace de travail ;fermez votre projet et rouvrez ou redémarrez STS avec l'option -clean.L’une des solutions ci-dessus le fera fonctionner pour vous.HTH