Как решить, "объявление может быть найдено для элемента 'oxm: jaxb2-marshaller'."? - PullRequest
0 голосов
/ 20 декабря 2018

Предисловие: я работаю над Java-приложением, созданным на Spring.Я все еще изучаю Spring, так что, возможно, я упустил какое-то очевидное решение моей проблемы.

Каждый раз, когда я запускаю модульные / интеграционные тесты для этого приложения, некоторые из этих автоматических тестов завершаются со следующей ошибкой:

java.lang.IllegalStateException: Failed to load ApplicationContext 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
.
.
.
Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 59; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'oxm:jaxb2-marshaller'. 
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

Вот файл контекста приложения, который не работает:

<?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:oxm="http://www.springframework.org/schema/oxm"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans 
           http://www.springframework.org/schema/beans/spring-beans.xsd 
           http://www.springframework.org/schema/oxm 
           http://www.springframework.org/schema/oxm/spring-oxm.xsd">
  <oxm:jaxb2-marshaller id="myMarshaller">
    <oxm:class-to-be-bound name="com.me.types.MyClass" />
  </oxm:jaxb2-marshaller>
</beans>

Вот соответствующая часть моего pom:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
    <version>4.3.12.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-core</artifactId>
    <version>2.4.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.9.1</version>
</dependency>

Я не могу понятьчто мешает контексту приложения раскрутиться.Я вытаскиваю не ту банку?Я неправильно объявил свое пространство имен?Мой прокси-сервер что-то ломает?

Любая помощь будет признательна.

...