1

我将 Jax-WS 与 Spring 一起使用,我的 ApplicationContext 没有显示任何错误,但是当我启动我的 tomcat 时会生成一个 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"
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)

4

1 回答 1

1

好的,从您的位置架构定义中,您缺少dev.某些部分,例如用于 jaxws 定义的核心和 servlet 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
   http://jax-ws.dev.java.net/spring/servlet.xsd

上述问题将得到解决。

于 2013-05-14T18:29:51.807 回答