You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2013/03/25 19:33:15 UTC

[jira] [Resolved] (CXF-4870) osgi field is always false when creating a SpringBus via SpringBusFactory in OSGI ENV

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

Daniel Kulp resolved CXF-4870.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6.7
                   2.7.4
    
> osgi field is always false when creating a SpringBus via SpringBusFactory in OSGI ENV
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-4870
>                 URL: https://issues.apache.org/jira/browse/CXF-4870
>             Project: CXF
>          Issue Type: Bug
>          Components: OSGi
>    Affects Versions: 2.7.3
>            Reporter: liugang
>            Assignee: Willem Jiang
>             Fix For: 2.7.4, 2.6.7
>
>
> when using following code to create Camel CXF endpoint bus:
> {code}
> SpringCamelContext springCamelContext = (SpringCamelContext) context;
> ApplicationContext applicationContext = springCamelContext.getApplicationContext();
> busFactory = new SpringBusFactory(applicationContext);
> busFactory.createBus();
> {code}
> after deployed into Karaf, some extension can't be loaded.
> I checked the source code, the *osgi* flag of *SpringBeanLocator* is always false, because the *context* is an instanceof *BusApplicationContext* (created in method *createApplicationContext()* of SpringBusFactory), and it has no *getBundleContext* method.
> and in *OSGIBusListener* class, only when registered *ConfiguredBeanLocator* object is an instanceof *ExtensionManagerImpl*, the *OSGiBeanLocator* will be used:
> {code}
>     private void registerConfiguredBeanLocator() {
>         final ConfiguredBeanLocator cbl = bus.getExtension(ConfiguredBeanLocator.class);
>         if (cbl instanceof ExtensionManagerImpl) {
>             // wire in the OSGi things
>             bus.setExtension(new OSGiBeanLocator(cbl, defaultContext), 
>                              ConfiguredBeanLocator.class);
>         }
>     }
> {code}
> and *SpringBeanLocator* is not an instanceof *ExtensionManagerImpl*, so we can't load the extensions in OSGI ENV.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira