【问题标题】:Spring Boot Starter Integration and Starter WS not playing well together?Spring Boot Starter Integration 和 Starter WS 一起玩不好?
【发布时间】:2014-09-22 15:21:45
【问题描述】:

我正在努力尝试使用 spring boot (1.1.6.RELEASE)、gradle (2.1) 和 Java 1.8 来练习一些技术。所以我们正在考虑支持一些老式的 SOAP Web 服务调用以及 Spring 集成。因此,为了起步,我正在研究使用生成 Web 服务 (http://spring.io/guides/gs/producing-web-service/) 的示例并将 spring 集成添加到组合中。

当我这样做并尝试点击 WSDL 位置时,我现在看到了这个堆栈跟踪:

2014-09-22 09:53:17.823 ERROR 15188 --- [nio-8080-exec-1] a.c.c.C.[.[.[.[messageDispatcherServlet] : Servlet.service() for servlet[messageDispatcherServlet] in
 context with path [] threw exception [Request processing failed; nested exception is java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredDocumentImpl.getXmlStandalone()Z] with root cause

java.lang.AbstractMethodError: org.apache.xerces.dom.DeferredDocumentImpl.getXmlStandalone()Z
        at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:377)
        at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:131)
        at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:98)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:699)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:743)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:357)
        at org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter.handle(WsdlDefinitionHandlerAdapter.java:144)...

环顾四周,这似乎与为集成而引入的 Xerces 实现有关。您可以通过使用示例生产 SOAP Web 服务并将依赖项部分更改为如下所示来重现这一点:

dependencies {
    compile("org.springframework.boot:spring-boot-starter-ws")
    compile("wsdl4j:wsdl4j:1.6.1")
    jaxb("com.sun.xml.bind:jaxb-xjc:2.2.4-1")
    compile(files(genJaxb.classesDir).builtBy(genJaxb))
    compile("org.springframework.boot:spring-boot-starter-integration")
}

基本上添加 compile("org.springframework.boot:spring-boot-starter-integration") 然后尝试在 http://:/ws/countries 访问 WSDL。 wsdl。 (运行 gradle bootRun

现在可以说这可能不是最好的方法,也许我应该只看弹簧集成来公开端点,但有其他人看到并处理过这个吗?

提前致谢

特里斯坦

注意我确实添加了 compile "org.apache.ws.xmlschema:xmlschema-core:2.1.0" dep 这是我的 lib 目录中的 jar 列表

aopalliance-1.0.jar
aspectjrt-1.8.2.jar
aspectjweaver-1.8.2.jar
classmate-1.0.0.jar
commons-codec-1.2.jar
commons-httpclient-3.0.1.jar
commons-io-2.4.jar
hibernate-validator-5.0.3.Final.jar
jackson-annotations-2.3.0.jar
jackson-core-2.3.4.jar
jackson-databind-2.3.4.jar
jboss-logging-3.1.1.GA.jar
jcl-over-slf4j-1.7.7.jar
jdom-1.0.jar
jul-to-slf4j-1.7.7.jar
log4j-over-slf4j-1.7.7.jar
logback-classic-1.1.2.jar
logback-core-1.1.2.jar
rome-1.0.0.jar
rome-fetcher-1.0.0.jar
slf4j-api-1.7.7.jar
snakeyaml-1.13.jar
spring-aop-4.0.7.RELEASE.jar
spring-beans-4.0.7.RELEASE.jar
spring-boot-1.1.6.RELEASE.jar
spring-boot-autoconfigure-1.1.6.RELEASE.jar
spring-boot-starter-1.1.6.RELEASE.jar
spring-boot-starter-aop-1.1.6.RELEASE.jar
spring-boot-starter-integration-1.1.6.RELEASE.jar
spring-boot-starter-logging-1.1.6.RELEASE.jar
spring-boot-starter-tomcat-1.1.6.RELEASE.jar
spring-boot-starter-web-1.1.6.RELEASE.jar
spring-boot-starter-ws-1.1.6.RELEASE.jar
spring-context-4.0.7.RELEASE.jar
spring-core-4.0.7.RELEASE.jar
spring-expression-4.0.7.RELEASE.jar
spring-integration-core-4.0.3.RELEASE.jar
spring-integration-file-4.0.3.RELEASE.jar
spring-integration-http-4.0.3.RELEASE.jar
spring-integration-ip-4.0.3.RELEASE.jar
spring-integration-stream-4.0.3.RELEASE.jar
spring-jms-4.0.7.RELEASE.jar
spring-messaging-4.0.7.RELEASE.jar
spring-oxm-4.0.7.RELEASE.jar
spring-retry-1.1.0.RELEASE.jar
spring-tx-4.0.7.RELEASE.jar
spring-web-4.0.7.RELEASE.jar
spring-webmvc-4.0.7.RELEASE.jar
spring-ws-core-2.2.0.RELEASE.jar
spring-ws-support-2.2.0.RELEASE.jar
spring-xml-2.2.0.RELEASE.jar
tomcat-embed-core-7.0.55.jar
tomcat-embed-el-7.0.55.jar
tomcat-embed-logging-juli-7.0.55.jar
validation-api-1.1.0.Final.jar
wsdl4j-1.6.1.jar
xercesImpl-2.4.0.jar
xmlschema-core-2.1.0.jar

【问题讨论】:

    标签: java spring-integration spring-boot spring-ws spring-io


    【解决方案1】:

    对于 WSDL 生成,您应该提供此依赖项:

    compile "org.apache.ws.xmlschema:xmlschema-core:2.1.0"
    

    这在 Spring WS 中是可选的,看起来您的环境中没有合适的实现。

    更新

    也尝试添加xalan

    compile "xalan:xalan:2.7.1"
    

    https://groups.google.com/forum/#!topic/google-web-toolkit/07rVeEkCtyU

    或者用 Xerses 做一些技巧:java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String

    【讨论】:

    • 感谢您的回复(和编辑)!我试过了,但它让我落入了同一条船上。为了论证,我从我的 lib 目录中添加了 jar 列表,并添加了该依赖项。
    • 嗯……明白了。再次感谢!
    • 我在一个 Maven 项目中,所以我需要将最新的 xercesImpl 和最新的 xalan 添加到我的 pom 以修复我的异常。
    • 您的评论已经过时了。如果您有问题,请开始一个新问题。他们一直在移动的版本的问题,所以即使是这些旧的答案也可能已经过时了
    猜你喜欢
    • 2019-10-28
    • 2018-12-24
    • 2017-03-23
    • 2015-07-07
    • 2014-04-07
    • 2017-02-19
    • 2016-01-29
    • 1970-01-01
    相关资源
    最近更新 更多