[ 
https://issues.apache.org/jira/browse/CAMEL-4207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aki Yoshida updated CAMEL-4207:
-------------------------------

    Attachment: patch.txt

a minor correcton and cleanup to the spring beans xml and the test program.

M       
trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanBusSettingTest.java
M       
trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/spring/CxfEndpointBeansBusSetting.xml


> Test case CxfEndpointBeanBusSettingTest should use ExtensionManagerBus 
> instead of CXFBusImpl
> --------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-4207
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4207
>             Project: Camel
>          Issue Type: Test
>          Components: camel-cxf
>    Affects Versions: 2.7.2
>            Reporter: Aki Yoshida
>            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(AbstractWSDLBasedEndpointFactory.java:338)
>       at 
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:252)
>       at 
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:147)
>       at 
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)
>       at 
> org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:226)
>       at 
> org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:162)
>       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:1843)
>       at 
> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1771)
>       at 
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1556)
>       at 
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1448)
>       at 
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1338)
>       at 
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
>       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:204)
>       at 
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:99)
>       ... 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 constructor.
> 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: http://www.atlassian.com/software/jira

        

Reply via email to