簡體   English   中英

defaultMethodEndpointAdapter bean 創建錯誤

[英]defaultMethodEndpointAdapter bean creation error

我正在嘗試遵循 spring-boot 的 te 指南,以便運行 SOAP 服務器。 問題是它正在拋出這個錯誤:

2016-09-19 09:43:39.797  WARN 8668 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultMethodEndpointAdapter' defined in class path resource [org/springframework/ws/config/annotation/DelegatingWsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter]: Factory method 'defaultMethodEndpointAdapter' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.setCustomMethodArgumentResolvers(Ljava/util/List;)V

我的 ws 配置 bean 文件是:

@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);
    servlet.setTransformWsdlLocations(true);
    return new ServletRegistrationBean(servlet, "/ws/*");
}

@Bean(name = "expedientes")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema expedienteSchema) {
    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("ExpedientesPort");
    wsdl11Definition.setLocationUri("/ws");
    wsdl11Definition.setTargetNamespace("http://localhost/ws");
    wsdl11Definition.setSchema(expedienteSchema);
    return wsdl11Definition;
}

@Bean
public XsdSchema expedienteSchema() {
    return new SimpleXsdSchema(new ClassPathResource("Expedientes.xsd"));
}
}

它應該自動配置其余部分,所以我無法理解這個錯誤。

我在整個網站上瀏覽了一些相關的錯誤,但沒有任何幫助。 請問有什么提示嗎?

你得到的錯誤是

java.lang.NoSuchMethodError: org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.setCustomMethodArgumentResolvers(Ljava/util/List;)V

類“DefaultMethodEndpointAdapter”是 spring-ws-core jar 文件的一部分。 方法“DefaultMethodEndpointAdapter.setCustomMethodArgumentResolvers(List customMethodArgumentResolvers)”從 spring-ws-core-2.2.0.RELEASE.jar 開始可用。 以下是使用 Spring Boot 1.4.0 的 WS 項目所需的依賴項,根據 spring 指南https://spring.io/guides/gs/production-web-service/它將下載最新的 spring-ws-core-2.3。 0.RELEASE.jar。 請檢查您在 pom.xml 中使用的依賴項和版本。

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-ws</artifactId>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
    </dependency>
</dependencies>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM