Spring metro integration cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'wss:binding'

StackOverflow https://stackoverflow.com/questions/13347609

質問

I try to integrate metro web-service with spring. But I get errors in my applicationContext.xml

  <?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: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.xsd
                            http://jax-ws.dev.java.net/spring/core 
                            http://jax-ws.dev.java.net/spring/core.xsd
                            http://jax-ws.dev.java.net/spring/servlet 
                            https://jax-ws.dev.java.net/spring/servlet.xsd">
//Some beans

//!!!!!!!!ERROR
    <wss:binding url="/ws">
        <wss:service>
            <ws:service bean="#newsWebService" />
        </wss:service>
    </wss:binding>

    <bean id="newsWebService" class="com.news.webservice.NewsWebService">
        <property name="newsBo" ref="newsBo"/>
    </bean>

</beans>

Error message:

Multiple annotations found at this line:
    - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'wss:binding'.
    - schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java.net/spring/servlet.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>.

I add lib x-bean-spring-3.7.jar and jaxws-spring-1.8.jar

Also I check spring.schemas in jaxws-spring-1.8.jar and get

# See XBEAN-60. To work around the overwriting issue, this file is maintained manually.
# this file is used by Spring to resolve resources locally.
# the key is the system ID and the value is the actual file location in this jar.
http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd

I included shemas according with this.

#UPDATED I found something strange. I open in spring-beans-3.2.0.M1.jar spring.shemas

http\://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd
http\://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd
http\://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http\://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd
http\://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd
http\://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd

I get applicationContext.xml without error just with http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd next pair

Please, help me find reason.

役に立ちましたか?

解決

EDIT: The previous answer was accepted by eclipse, but triggered an exception at runtime. Here is my final working config

Use this, the xsd schemas have been moved :

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       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.2.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.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
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
       default-lazy-init="true">

他のヒント

The java.net hosting web master administrator has caused problems by changing hosting paths.

Change all jax-ws.dev.java.net to jax-ws.java.net and the error disappears as on 28-Aug-2014.

It appears, thousands of developers time got wasted due to this.

Try replacing the line: http://www.springframework.org/schema/beans/spring-beans.xsd as it conflicts. Had same issue with similar configuration borrowed off an example on the Internet and this resolved it.

The head of the content of your applicationContext.xml should be:

<beans xmlns="http://www.springframework.org/schema/beans"
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-4.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">

The problem is because there isn't exist the URL http://jax-ws.dev.java.net/.

The project has been relocated and probably discontinued. Then, I suggest an alternative solution.

  1. Download to local the files (spring-jax-ws-core.xsd,spring-jax-ws-servlet.xsd) from the source jar in this URL https://repo1.maven.org/maven2/org/jvnet/jax-ws-commons/spring/jaxws-spring/1.9/jaxws-spring-1.9-sources.jar
  2. I have placed in the path "W:/dev/Spring4WebApp/", you can choose another one. I recommend you to upload and publish them in any own server in your company.
  3. Modify the appContext with the following lines:
 <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c" 
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://jax-ws.dev.java.net/spring/core
file:///W:/dev/Spring4WebApp/spring-jax-ws-core.xsd
http://jax-ws.dev.java.net/spring/servlet
file:///W:/dev/Spring4WebApp/spring-jax-ws-servlet.xsd">

Note the lines starting with "file:///". These lines reference to your local files. And voilà!! It runs!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top