JAX-WS Spring过早结束文件。第1行XML

时间:2013-05-14 17:46:06

标签: spring namespaces jax-ws

我在Spring中使用Jax-WS并且我的ApplicationContext没有显示任何错误,但是当我启动时,我的tomcat会生成XML错误。

我的applicationContext:

<?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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.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
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context.xsd">

<wss:binding url="/hello">
    <wss:service>
        <ws:service bean="#helloWs"/>
    </wss:service>
</wss:binding>

<!-- Web service methods -->
<bean id="helloWs" class="br.com.myproject.ws.HelloWorldWS">
    <property name="helloWorldBo" ref="HelloWorldBo" />
</bean>

<bean id="HelloWorldBo" class="br.com.myproject.ws.HelloWorldBoImpl" />
</beans>

生成此错误:

GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Premature end of file. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)

1 个答案:

答案 0 :(得分:1)

好的,从你的位置模式定义来看,dev.缺少某些部分,比如core和servlet xsd for jaxws definition。

应该如下:

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
   http://jax-ws.dev.java.net/spring/servlet.xsd

上述问题将得到解决。