We had exactly the same problem in my team when deploying a Spring DSL Camel
route with a CXF endpoint on a Glassfish appserver. We wanted to use the
HTTP server in Glassfish rather than a stand-alone Jetty HTTP server.
Finally we figured out how to do it: apart from importing cxf-servlet.xml
(which was mentioned in various places) we also had to specify the
cxfEndpoint address as the WSDL service name instead of an HTTP address.
This is not mentioned anywhere in the Camel CXF documentation as far as I
have seen, in fact I only found out about it by looking into the source code
of JOnAS. Also please note that, in contrast to jax-ws endpoints, there
should be no leading '/' in the address.

/Mikael


firefly099 wrote
> 
> I'm using Camel2.8.2. I was trying to invoke outside webservice with CXF.
> But I failed. Whatever I do, I always meet such exception below. Did I
> miss some dependencies? The doc is not clear and there is no example about
> how to invoking outside service. Hope somebody can help me out. thx.
> 
> org.apache.camel.RuntimeCamelException:
> org.apache.cxf.service.factory.ServiceConstructionException
>       at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1164)
>       at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:117)
>       at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)
>       at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
>       at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
>       at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
>       at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
>       at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
>       at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
>       at org.apache.camel.example.cxf.Test.main(Test.java:20)
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException
>       at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:176)
>       at
> org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:226)
>       at
> org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:181)
>       at
> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)
>       at
> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)
>       at org.apache.camel.impl.RouteService.warmUp(RouteService.java:124)
>       at
> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1846)
>       at
> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1774)
>       at
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1559)
>       at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1449)
>       at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)
>       at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:176)
>       at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>       at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>       at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1316)
>       at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:221)
>       at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:115)
>       ... 8 more
> Caused by: java.io.IOException: Cannot find any registered
> HttpDestinationFactory from the Bus.
>       at
> org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:270)
>       at
> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:134)
>       at 
> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)
>       at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
>       at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:158)
> 


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-config-cxf-in-project-tp5000149p5643205.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to