【问题标题】:JAX-WS Spring premature end of file. Line 1 XMLJAX-WS Spring 文件过早结束。第 1 行 XML
【发布时间】:2013-05-14 17:46:05
【问题描述】:

我在 Spring 中使用 Jax-WS,我的 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)

【问题讨论】:

  • 您确定您的 applicationContext.xml 实际打包在您的 war 文件中并且存在于 /WEB-INF 下吗?

标签: spring namespaces jax-ws


【解决方案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

上述问题将得到解决。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 2013-04-08
    • 2012-06-22
    • 2017-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多