You need configure a cxf bus for servicemix-cxf-bc component level, so that all endpoints with servicemix-cxf-bc can use this bus, your current way can't do it.
1. add a org.apache.servicemix.components.cxfbc.cfg in $FUSE_ESB/etc folder,
add an entry
busCfg="the relative path for the cxf bus configure file in your bundle"
2. make your bundle containing the cxf bus configure file and interceptor class as a fragment bundle and attach it to servicemix-cxf-bc bundle, so that the bus configure file is available for the servicemix-cxf-bc bundle.
Thank you very much for your help Freeman,
I noticed that in my servicemix log file I have this WARN message. Is it related with what you have suggested me?
I'm sorry to say that I'm not very experienced on FUSE. Could you maybe provide me some links of how to proceed about the instructions you gave me before?
warn.txt 5.5 K
I guess what confused you in my previous suggestion is the fragment bundle part, right?
If so, fragment bundle is a general OSGi concept but not FUSE ESB specific, you can google to get more details about how fragment bundle works.
About the WARN message, could you tell me how you encounter it?
Generally this is caused by your bundle missing Import-Package META-INF.cxf, you can add it into your pom.xml maven-bundle-plugin configuration to see if it helps.
Thanks one more time. However , I still feel a bit lost in this huge world
I'll try to explain myself better and how I have proceed step by step.
First, with Eclipse IDE I create a new Maven Project using spring-osig-bundle archetype.
Using this template, I create my interceptros class (InterceptorCXF.java).
After that, I configure the <cxf:bus> in the bundle-context.xml.
Then, I do mvn install to generate my .jar file. I copy this .jar in my FUSE deploy folder and then I start servicemix. The bundle starts properly.
After that, I thought that a good way to test whether the interceptor works or not is deploying also some of the examples available in FUSE. However, here is the problem , i cannot intercept anything.
About your suggestions. I am not sure how I can set up my Eclipse environment to work as you suggested. Also , I do not have any filed named cxf.xml.
Which kind of format should have the file org.apache.servicemix.components.cxfbc.cfg ?
I know..many questions...
I attach you my project, probably will help to understand what I am saying.
Your interceptor doesn't work is that from your bundle it just create a single cxf bus which is not picked up by servicemix-cxf-bc component, so that it can't be aware of any cxfbc endpoint consequently.
What I suggest you is that you should configure a component level bus which could be shared by all cxfbc endpoints.
The org.apache.servicemix.components.cxfbc.cfg is just a text file under $FUSE_ESB/etc folder, you need add this file yourself and specify the busCfg entry there. And such cfg file leverage OSGi configureAdmin service to pick up properties during runtime.
About the cxf.xml file, it exist in cxf bundle under META-INF/cxf and could be used from your customer bundle, so your customer bundle should import package META-INF.cxf to ensure cxf.xml is available for your bundle.
In your Eclipse generated project, there's a pom.xml which use maven-bundle-plugin, you can configure that plugin to add any package import you want.
I think I have succesfully added META-INF/cxf to my customer bundle ( at least I do not have any more the previous error message in fuse log file). I have added some in my bundle-context.xml.
But still i do not intercept messages. Then I guess is because my bundle is a "regular" bundle, and not a fragment bundle. How I can attach a fragment bundle if the bundle is in FUSE and i'm working in a eclipse environment?
Could you please give me more details about how configuring a component level bus which could be shared by all cxfbc endpoints ?
many thanks for your help
I added to my pom this:
Is this the way to indicate that is a fragment bundle depending of org.apache.servicemix.servicemix-cxf-bc bundle?
Here the problema I have now is that the bundle appears as "installed" but cannot be started.
You should use Bundle-SymbolicName of servicemix-cxf-bc bundle for Fragment-Host, which should be
After you doing it, you need refresh servicemix-cxf-bc bundle to pick up your fragment bundle.
The correct status for your fragment bundle should be "Resolved", if you saw it not "Resolved", there must be some exception in data/log/servicemix.log which can indicate you what's wrong there.
Just an example how host/fragment bundle looks like if you use "osgi:list" to list bundle status.
For Host, it like
which indicate it has the fragment bundle with bundle id 53
For fragment, it like
which means it's a fragment bundle (notice the status is "Resolved" but not the normal "Active"), the hosts is with bunle id 43.
I'm using FUSE ESB v4.2 instead of FUSE ESB v4.3
Does this make any difference for what we are talking about?
You should use FUSE 4.3, so that the busCfg you specified in org.apache.servicemix.components.cxfbc.cfg could be picked up.
SMXCOMP-802 tracked this issue.
Hi Freeman ,
I feel I am progressing, and that is precisely for your valuable help!! Thank you so much.
Indeed, you were right, I have moved to FUSE ESB v4.3 and now it seems I have "attached" my bundle successfully.
However, I am not sure that I specify busCfg org.apache.servicemix.components.cxfbc.cfg properly ( I have attached my file) .
If this file is correct, I'm wondering that could be just that the way I'm trying to test is wrong. What I use is the "cxf-wsdl-first-osgi-package" example in FUSE.
What I do is to install that example and later with the web-client click "send" ( file:///C:/apache-servicemix-4.2.0-fuse-02-00/examples/cxf-wsdl-first-osgi-package/client.html). I reveice a proper STATUS 200 OK but any trace capture in my interceptor.
Once again, many thanks
isn't correct, it should be the relative path in your bundle
With your original busCfg configuration, I think you should see some exception in data/log/servicemix.log to complain can't load file.
I have been reading the log file and I have found this entry.
10:09:35,831 | INFO | ExtenderThread-2 | XmlBeanDefinitionReader | tory.xml.XmlBeanDefinitionReader 315 | 60 - org.springframework.beans - 3.0.3.RELEASE | Loading XML bean definitions from URL bundle://171.0:0/META-INF/spring/bundle-context-osgi.xml
10:09:36,046 | INFO | ExtenderThread-2 | XmlBeanDefinitionReader | tory.xml.XmlBeanDefinitionReader 315 | 60 - org.springframework.beans - 3.0.3.RELEASE | Loading XML bean definitions from URL bundle://171.0:0/META-INF/spring/bundle-context.xml
I guess it means that the busCfg is loaded properly right?
No idea why still doesn't work...
Attached also the log file if you need to check something
all the best,
Edited by: niyyel on Feb 25, 2011 9:26 AM
Edited by: niyyel on Feb 25, 2011 9:28 AM
servicemix.log 61.3 K