I have recently started working on a project in which we have expose SOAP end point using Apache camel with spring Ws and few endpoints for ActiveMQ as well. Version which i am using are as below :
Spring boot : 1.5.3 camel-spring-ws : 2.17.1
I have done all the configuration and created as explained in the Apache camel Spring WS page. Different configuration files and pom files are as below .
But whenever i am deploying my app i am getting below . Could not find any relevant answer for this. Please help.
Exception :
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: spring-ws://rootqname:%7Bhttp://springWsSecurity.com/types/helloworld%7DSayHelloInput?endpointMapping=%23endpointMapping due to: No bean could be found in the registry for: endpointMapping of type: org.apache.camel.component.spring.ws.bean.CamelSpringWSEndpointMapping
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:678) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:219) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:118) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:69) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:94) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1278) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:204) ~[camel-core-2.19.0.jar:2.19.0]
... 27 common frames omitted
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: endpointMapping of type: org.apache.camel.component.spring.ws.bean.CamelSpringWSEndpointMapping
at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:173) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.util.EndpointHelper.resolveReferenceParameter(EndpointHelper.java:326) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.util.EndpointHelper.resolveReferenceParameter(EndpointHelper.java:308) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultComponent.resolveAndRemoveReferenceParameter(DefaultComponent.java:415) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addEndpointMappingToConfiguration(SpringWebserviceComponent.java:140) ~[camel-spring-ws-2.17.1.jar:2.17.1]
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.addConsumerConfiguration(SpringWebserviceComponent.java:83) ~[camel-spring-ws-2.17.1.jar:2.17.1]
at org.apache.camel.component.spring.ws.SpringWebserviceComponent.createEndpoint(SpringWebserviceComponent.java:67) ~[camel-spring-ws-2.17.1.jar:2.17.1]
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:116) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:631) ~[camel-core-2.19.0.jar:2.19.0]
... 35 common frames omitted
Pom.xml as below :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project`enter code here`.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<amq.version>5.4.2</amq.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>${amq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>${amq.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-ws</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
WebServiceConfig.java as below
package com.ordermanagement.apache.camel.OrderManagementUsingApacheCamel.configuration;
import org.apache.camel.Endpoint;
import org.apache.camel.component.spring.ws.bean.CamelEndpointMapping;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.server.EndpointAdapter;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter;
import org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
@EnableWebMvc
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ishantg/ws");
}
@Bean(name="helloworld")
public SimpleWsdl11Definition defaultWsdl11Definition(){
SimpleWsdl11Definition defaultWsdl11Definition = new SimpleWsdl11Definition();
defaultWsdl11Definition.setWsdl(new ClassPathResource("wsdl/greeting.wsdl"));
return defaultWsdl11Definition;
}
@Bean
public PayloadLoggingInterceptor loggingInterceptor(){
return new PayloadLoggingInterceptor();
}
@Bean
public EndpointAdapter endpoint(){
return new MessageEndpointAdapter();
}
@Bean(name = "camelEndpointMapping")
public CamelEndpointMapping camelEndpointMapping(PayloadLoggingInterceptor loggingInterceptor ) {
CamelEndpointMapping endpointMapping = new CamelEndpointMapping();
endpointMapping.setInterceptors(new EndpointInterceptor[]{loggingInterceptor});
return endpointMapping;
}
}
SpringWs Route as below :
package com.ordermanagement.apache.camel.OrderManagementUsingApacheCamel.route;
import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SpringWsRoute extends RouteBuilder {
static final Logger log = LoggerFactory.getLogger(SpringWsRoute.class);
@Override
public void configure() throws Exception {
from("spring-ws:rootqname:{http://springWsSecurity.com/types/helloworld}SayHelloInput?endpointMapping=#endpointMapping")
.log(LoggingLevel.INFO, "Spring ws Recieved Message");
}
}
The bean is named
@Bean(name = "camelEndpointMapping")
But in the Camel endpoint you do not use the same name
endpointMapping=#endpointMapping
Change either of them so they use the same name, such as
endpointMapping=#camelEndpointMapping