Spring Boot Starter Integration和Starter WS不能很好地协同工作?

时间:2014-09-22 15:21:46

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

我正在努力尝试使用spring boot(1.1.6.RELEASE),gradle(2.1)和Java 1.8来运用多种技术。因此,我们正在寻求支持一些旧式SOAP Web Service调用以及Spring Integration。因此,为了开始,我正在寻找使用示例来生成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

现在可以说这可能不是最好的方法,也许我应该只考虑Spring集成来暴露端点,但有其他人看到并处理过这个问题吗?

提前致谢

特里斯坦

注意我确实添加了编译“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

1 个答案:

答案 0 :(得分: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