如何解决“当文档没有root”时尝试写END_DOCUMENT错误?

时间:2015-05-05 16:36:52

标签: eclipse web-services tomcat wsdl jax-ws

我继续=))使用Eclipse在Tomcat 7上创建jax-ws soap web服务(取得了不同的成功)。

我的Eclipse“mavened”webapp项目中有界面:

@WebService(targetNamespace = "http://new.webservice.namespace", name = "MayaServiceInterface")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface MayaServiceInterface {


    @WebResult(name = "getPersonResponse", targetNamespace = "http://new.webservice.namespace", partName = "parameter")
    public getPersonResponse getCustomer(
        @WebParam(partName = "parameter", name = "getPersonRequest", targetNamespace = "http://new.webservice.namespace")
        getPersonRequest parameter

    );

}

和实现接口的类:

@javax.jws.WebService
     (
                      serviceName = "ABCWsService",
                      portName = "ABCWsPort",
                      targetNamespace = "http://new.webservice.namespace",
                      endpointInterface = "com.mayacomp.ws.MayaServiceInterface")


public class MayaServiceEndPoindImpl implements MayaServiceInterface {

    @Override
    public getPersonResponse getCustomer(getPersonRequest parameter) {
        // TODO Auto-generated method stub
        return null;
    }


} // end of class

当我尝试“在服务器上运行”网络服务时,我会收到一个包含下一个信息的页面:

  

Web服务端点信息服务名称:   {http://new.webservice.namespace} ABCWsService端口名称:   {http://new.webservice.namespace} ABCWsPort地址:   http://localhost:8080/maya-web-service/ABCWs WSDL:   http://localhost:8080/maya-web-service/ABCWs?wsdl实施   class:com.mayacomp.ws.MayaServiceEndPoindImpl

当我点击http://localhost:8080/maya-web-service/ABCWs?wsdl时,我在eclipse控制台中收到HTTP 500错误和下一个信息:

  

2015年5月5日下午7:08:16   com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet SEVERE:   抓住throwable java.io.IOException:尝试编写END_DOCUMENT   当文档没有root(即尝试输出空文档)时。在   com.sun.xml.ws.server.SDDocumentImpl.writeTo(SDDocumentImpl.java:299)     在   com.sun.xml.ws.transport.http.HttpAdapter.publishWSDL(HttpAdapter.java:931)     在   com.sun.xml.ws.transport.http.HttpAdapter.handleGet(HttpAdapter.java:440)     在   com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:193)     在   com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:161)     在   com.sun.xml.ws.transport.http.servlet.WSServlet.doGet(WSServlet.java:89)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:624)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:731)at at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)     在   org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)     在   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)     在   org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)     在   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)     在   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)     在   org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:620)     在   org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:316)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     在   org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)     在java.lang.Thread.run(Thread.java:745)引起:   javax.xml.stream.XMLStreamException:尝试写END_DOCUMENT时   文档没有root(即尝试输出空文档)。在   com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1518)     在   com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1547)     在   com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1373)     在com.ctc.wstx.sw.BaseStreamWriter.close(BaseStreamWriter.java:243)     在   com.sun.xml.ws.util.xml.XMLStreamWriterFilter.close(XMLStreamWriterFilter.java:67)     在   com.sun.xml.ws.server.SDDocumentImpl.writeTo(SDDocumentImpl.java:297)     ......还有27个

但我等着接收wsdl(如果这听起来不奇怪)。请帮我修复此错误并查看我的wsdl。

1 个答案:

答案 0 :(得分:0)

问题在于stax-ex jar。

  • 您可以将stax-ex-1.7.7.jar放入您的图书馆位置
  • 你可以添加     org.jvnet.staxex     STAX-EX     1.7.7

到你的pom.xml