Sunday, September 19, 2010

How to configure cxf bus for smx-cxf-bc in SMX4?

In Apache Servicemix[1] 3.x or FuseSource[2] ESB 3.x, we use busCfg to specify cxf bus configuration file for servicemix-cxf-bc[3] component, and busCfg is popularly used in serivicemix-cxf-bc for advanced features, such as ws-*, https, jms transport, etc.

How ever, there's an issue for using busCfg in Apache Servicemix[1]4.x or FuseSource[2] ESB 4.x which is based on an OSGi core container. In OSGi world, it use a very different classloader machenism with the old hierarchical one, so that the the busCfg file in customer cxfbc endpoint bundle isn't available for pre-installed cxf bundle. The way to use busCfg in SMX4 is that create a fragment bundle including the busCfg file, and attach it to cxf bundle, here cxf bundle play the role as host bundle and all resource in fragment bundle is available for host bundle. Actually we can encounter similar issue often in OSGi world, if the api is passing a configuration file, we can see the same problem, the bundle host the api code can't load the resource from the customer bundle which use the api. Here is a similar discussion from FUSE side jira(ESB-1245)[4], a problem caused by need pass WSS4J signature properties file to wss4j bundle.

Besides using fragment bundle to hold configuration files, we introduce providedBus(SMXCOMP-688)[5] in smx4 which init cxf bus bean in same context with cxf bc endpoint configuration, this way avoid passing configuration file between bundles.

[1]http://servicemix.apache.org/home.html
[2]http://fusesource.com/
[3]http://servicemix.apache.org/servicemix-cxf-bc.html
[4]http://fusesource.com/issues/browse/ESB-1245
[5]https://issues.apache.org/activemq/browse/SMXCOMP-688

No comments:

Post a Comment