匹配的通配符是严格的,但是没有找到元素' wss:binding'

时间:2014-02-26 17:44:36

标签: jax-ws spring-ws

运行maven clean install时,出现以下错误:

  

匹配的通配符是严格的,但是找不到声明   元素'wss:binding'

我不明白为什么会出现此错误,因为它是https://jax-ws-commons.java.net/spring/上示例的复制粘贴。我的依赖项中也有xbean-spring v3.16。

我检查了http://jax-ws.java.net/spring/servlet.xsd元素绑定是否存在!

这是我复制/粘贴的文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ws="http://jax-ws.dev.java.net/spring/core"
  xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
  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.xsd
    http://jax-ws.java.net/spring/core
    http://jax-ws.java.net/spring/core.xsd
    http://jax-ws.java.net/spring/servlet
    http://jax-ws.java.net/spring/servlet.xsd">

    <context:component-scan base-package="com.example.ws.soap.service.impl" />

    <wss:binding url="/service/desoteServicePort">
        <wss:service>
            <ws:service bean="#desoteService" />
        </wss:service>
    </wss:binding>

</beans>

我的档案有什么问题?

2 个答案:

答案 0 :(得分:3)

名称空间不匹配。您声明了名称空间:

<beans ...
  xmlns:ws="http://jax-ws.dev.java.net/spring/core"
  xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"

但是当您与架构位置建立关联时,您使用了不同的命名空间:

  xsi:schemaLocation=" ...

    http://jax-ws.java.net/spring/core    http://.../core.xsd
    http://jax-ws.java.net/spring/servlet http://.../servlet.xsd">

您声明的名称空间中有一个额外的“dev”,它与您与XSD位置关联的名称空间中不存在。

你可能会混淆不同版本的Spring。

答案 1 :(得分:3)

正如@helderdarocha指出的那样,样本有效,但文档错误。令人惊讶的是,自上次更新JAX-WS Commons以来约一年内,这种情况尚未得到澄清。

也就是说,下面的标题(来自here)有效:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:ws="http://jax-ws.dev.java.net/spring/core"
       xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://jax-ws.dev.java.net/spring/core
       http://jax-ws.java.net/spring/core.xsd
       http://jax-ws.dev.java.net/spring/servlet
       http://jax-ws.java.net/spring/servlet.xsd">