2013-05-14 70 views
1

即时使用Jax-WS与Spring和我的ApplicationContext不显示任何错误,但是当我启动我的Tomcat时会生成一个XML错误。JAX-WS文件过早结束。第1行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)

+0

你确定你的applicationContext.xml实际上是打包在你的war文件中,并存在于/ WEB-INF下吗? – Kal 2013-05-14 17:51:43

回答

1

好了,从位置您模式定义,您正在使用dev.缺少像核心和servlet XSD的某些部分jaxws的定义。

应该如下:

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 

上述问题将得到解决。