Got JAXB error when migrate from spring to Spring boot I with Camel 3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Got JAXB error when migrate from spring to Spring boot I with Camel 3

Jessie Ding
Hi

I will work on Spring-ws component for spring boot.
The example under the following directory is running well. When I try to migrate the example from spring to spring boot. I got some jaxb errors. I wonder whether it is jaxb problem or my endpoint configuration problems. Please help! Thanks a lot!
https://github.com/apache/camel/tree/master/examples/camel-example-spring-ws

In the IncrementRoute.java


@Component
public class IncrementRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {

        JaxbDataFormat jaxb = new JaxbDataFormat(IncrementRequest.class.getPackage().getName());

        from("spring-ws:rootqname:{http://camel.apache.org/example/increment}incrementRequest?endpointMapping=#endpointMapping")
        .unmarshal(jaxb)
        .process(new IncrementProcessor())
        .marshal(jaxb);
}

When I use soap UI to send request, I got the following errors.

No adapter for endpoint [Consumer[spring-ws://rootqname:(http://camel.apache.org/example/increment}incrementRequest?endpointMapping=%23endpointMapping]]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
I used spring boot 2.1.2 and camel 3 version.  (using Camel-spring-ws-starter and camel-jaxb-starter components)
The webservice configuration is like


@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setTransformWsdlLocations(true);
    servlet.setApplicationContext( applicationContext );
    ServletRegistrationBean bean = new ServletRegistrationBean(servlet, CAMEL_URL_MAPPING);
    bean.setLoadOnStartup(1);
    return bean;
}


/*
 * Endpoint mappings
 */
@Bean(name = "endpointMapping")
public CamelEndpointMapping camelEndpointMapping()
throws IOException {
    CamelEndpointMapping endpointMapping = new CamelEndpointMapping();

    endpointMapping.setCamelContext(context);
    logger.info(endpointMapping.toString());
    EndpointInterceptor[] interceptors = {validatingInterceptor(), loggingInterceptor() };
    endpointMapping.setInterceptors(interceptors);
    return endpointMapping;
}

@Bean(name = "validatingInterceptor")
public PayloadValidatingInterceptor validatingInterceptor() {
    PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor();
    payloadValidatingInterceptor.setSchema(new ClassPathResource( "increment.xsd" ));
    payloadValidatingInterceptor.setValidateRequest(true);
    payloadValidatingInterceptor.setValidateResponse(true);
    return payloadValidatingInterceptor;
}

@Bean(name = "loggingInterceptor")
public PayloadLoggingInterceptor loggingInterceptor() {
    return new PayloadLoggingInterceptor();
}


Jessie Ding