Mohanraj
Mohanraj

Reputation: 406

Unable to create route in apache-camel

I am working on spring rest app with camel routes. I need to create route for each rest calls and transfer data to another soap server.Here is my code snippet.

Rest Controller

public class CreateEmployeeController{
@Autowired
ProducerTemplate producerTemplate;

@RequestMapping (value = "/api/createEmployee",method = RequestMethod.POST)
public void createEmployee(@RequestBody Object employee) {
    producerTemplate.sendBody("direct:createEmployee",employee);
}

Camel Configuration

@Configuration
@ComponentScan ("com.employee.restService")
public class RouteConfig extends CamelConfiguration {

}

Camel Route

@Configuration
@Component
public class CreateEmployeeRouter extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("direct:createEmployee")
                .to("spring-ws:CreateEmployeeEndpointService");
    }
}

Dependancy

<dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.19.2</version>
        </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-cxf -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.19.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-javaconfig -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-javaconfig</artifactId>
        <version>2.19.2</version>
    </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-ws -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-spring-ws</artifactId>
    <version>2.19.2</version>
</dependency>

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot</artifactId>
        <version>2.19.2</version>
    </dependency>

StackTrace

    org.apache.camel.spring.boot.CamelSpringBootInitializationException: 
org.apache.camel.FailedToCreateRouteException: Failed to create route 
route1 at: >>> To[spring-ws:CreateEmployeeEndpointService] <<< in route: 
Route(route1)[[From[direct:createEmployee]] -> [To[spring-ws... because of Failed to resolve endpoint: spring-ws://CreateEmployeeEndpointService due to: No component found with scheme: spring-ws
        at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:225) ~[camel-spring-boot-2.19.2.jar:2.19.2]

Please help me if I am wrong. Thanks in advance.

Upvotes: 0

Views: 3679

Answers (1)

DeadSpock
DeadSpock

Reputation: 478

Switch your camel dependencies to 2.20.0, it worked for me

Upvotes: 1

Related Questions