camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <>
Subject [jira] [Commented] (CAMEL-4207) Test case CxfEndpointBeanBusSettingTest should use ExtensionManagerBus instead of CXFBusImpl
Date Mon, 11 Jul 2011 07:31:59 GMT


Willem Jiang commented on CAMEL-4207:

Applied the patch into trunk with thanks to Aki.

> Test case CxfEndpointBeanBusSettingTest should use ExtensionManagerBus instead of CXFBusImpl
> --------------------------------------------------------------------------------------------
>                 Key: CAMEL-4207
>                 URL:
>             Project: Camel
>          Issue Type: Test
>          Components: camel-cxf
>    Affects Versions: 2.7.2
>            Reporter: Aki Yoshida
>            Assignee: Willem Jiang
>            Priority: Minor
>             Fix For: 2.7.3, 2.8.0
>         Attachments: patch.txt
> I noticed a minor deficiency in one of the CXF spring configuration tests in the current
Camel trunk.
> In org.apache.camel.component.cxf.spring.CxfEndpointBeanBusSettingTest, the two CXF bus
instances are configured and referenced from the two Camel CXF endpoints.
> This test runs without errors. But if you try to use this example in a real scenario
where these CXF endpoints are actually referenced in the Camel route, you will get an NPE
at the following code line.
>     protected BindingInfo createBindingInfo() {
>         BindingFactoryManager mgr = bus.getExtension(BindingFactoryManager.class);
>                   ...
>            bindingFactory = mgr.getBindingFactory(binding); //<--- this line
> Caused by: java.lang.NullPointerException
> 	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(
> 	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(
> 	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(
> 	at org.apache.cxf.frontend.ServerFactoryBean.create(
> 	at org.apache.camel.component.cxf.CxfConsumer.<init>(
> 	at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(
> 	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(
> 	at org.apache.camel.impl.DefaultRoute.onStartingServices(
> 	at org.apache.camel.impl.RouteService.warmUp(
> 	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(
> 	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(
> 	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(
> 	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(
> 	at org.apache.camel.impl.DefaultCamelContext.doStart(
> 	at org.apache.camel.spring.SpringCamelContext.doStart(
> 	at org.apache.camel.impl.ServiceSupport.start(
> 	at org.apache.camel.impl.ServiceSupport.start(
> 	at org.apache.camel.impl.DefaultCamelContext.start(
> 	at org.apache.camel.spring.SpringCamelContext.maybeStart(
> 	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(
> 	... 31 more
> This null BindingFactoryManager instance is the result from the configuration that uses
CXFBusImpl directly, as
>     <bean id="cxf1" class="org.apache.cxf.bus.CXFBusImpl"/>
>     <bean id="cxf2" class="org.apache.cxf.bus.CXFBusImpl"/>
> In CXF 2.4, the standard extensions are inserted into the bus at org.apache.cxf.bus.extension.ExtensionManagerBus's
> Therefore, in order to get the BindingFactoryManager inserted into the bus to avoid this
NPE, the ExtensionManagerBus class should be used instead of CXFBusImpl as the class parameter.
Alternatively, as this is a spring configuration, we could use org.apache.cxf.bus.spring.SpringBus.
But I think ExtensionManagerBus is more neutral and therefore probably more suitable as an
example to the users.
>     <bean id="cxf1" class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
>     <bean id="cxf2" class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
> I am attaching a patch file suggesting this change and also another minor change in the
test program to add a few more assertion checks.
> Regards, aki

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message