5 Replies Latest reply on Nov 12, 2009 12:33 PM by Eoin Shanaghy

    cxf.xml configuration in Camel

    Eoin Shanaghy Newbie

      Hi,

      This question is part Camel, part CXF and part Fuse, so I hope this is the right forum. 

      I have a camel route where I'd like to do some configuration on CXF endpoints not possible the CXF camel component.  The CXF documentation indicates that if you have a cxf.xml in your classpath, configuration like this will be picked up:

       

      <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"

          xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration

                 http://cxf.apache.org/schemas/configuration/http-conf.xsd

                 http://www.springframework.org/schema/beans

                 http://www.springframework.org/schema/beans/spring-beans.xsd">

       

           

          <http-conf:conduit name="*.http-conduit">

              <http-conf:client AllowChunking="false" />

              <http-conf:basicAuthSupplier bean="myBasicAuthSupplier"/>

          </http-conf:conduit>

      </beans>

       

      I'm running my route in fuse and the cxf.xml is not picked up.  When I run it using mvn camel:run or using camel Main.main, it picks up the config file and runs perfectly.  My assumption is that the cxf.xml from cxf-bundle.jar in FUSE is getting picked up instead.  Digging into the CXF documentation, I saw that I can set the cxf.config.file system property in the Fuse/servicemix startup script to point to a CXF config file on the filesystem.  This works too, but it's not a solution we can live with in a proper system. 

       

      Is there any robust way of getting the cxf configuration picked up as part of our bundle and used exclusively for that bundle?

       

      I'm using fuse 4.1.0.2 with Camel 1.6.1.2-fuse and CXF 2.2.2.1-fuse but I have also tried this with Servicemix 4.0.0.0 Camel 1.6.0.

       

      Thanks in advance!

      Eoin

        • 1. Re: cxf.xml configuration in Camel
          Dave Stanley Novice

          Hi Eoin,

          If you stick the cxf.xml file in your resources directory (assuming its a maven project), then it should get picked up.

           

          Are you using Fuse ESB 3.x or 4.x?

           

          Thanks

          /Dave

          • 2. Re: cxf.xml configuration in Camel
            Eoin Shanaghy Newbie

            Hi Dave,

            I'm using Fuse ESB 4.1.0.2.  I had it in my src/main/resources, and it was being included in the bundle JAR in the right place.  It just seemed that the file was being ignored/overwritten because the configuration was not applied.

            Regards,

            Eoin

            • 3. Re: cxf.xml configuration in Camel
              Willem Jiang Master

              Can you try to import the configure file from you application configuration ?

              Like this

                  

              .....

              • 4. Re: cxf.xml configuration in Camel
                Eoin Shanaghy Newbie

                Hi,

                Thanks for the suggestion.  I tried it, and it worked...eventually!

                 

                First of all Fuse couldn't find cxf.xml

                 

                Caused by: java.io.FileNotFoundException: OSGi resource[classpath:METAINF/cxf/cxf.xml|bnd.id=193|bnd.sym=.....] cannot be resolved to URL because it does not exist

                 

                So I added META-INF.cxf to my <Import-Package/> element for my bundle.  Then followed a whole series of ClassNotFoundExceptions so I have ended up with this for my bundle. 

                       <Import-Package>org.slf4j;version=1.4.3,

                                org.springframework.beans.factory.config;version=2.5.6,

                                org.apache.cxf,

                                org.apache.cxf.binding.soap.spring,

                                org.apache.cxf.bus,

                                org.apache.cxf.bus.spring,

                                org.apache.cxf.bus.resource,

                                org.apache.cxf.configuration.spring,

                                org.apache.cxf.configuration,

                                org.apache.cxf.binding,

                                org.apache.cxf.transport,

                                org.apache.cxf.wsdl11,

                                org.apache.cxf.phase,

                                org.apache.cxf.workqueue,

                                org.apache.cxf.buslifecycle,

                                org.apache.cxf.endpoint,

                                org.apache.cxf.headers,

                                org.apache.cxf.catalog,

                                org.apache.cxf.binding.soap,

                                org.apache.cxf.transport.http.policy,

                                org.apache.cxf.transport.http,

                                org.apache.cxf.transport.http_jetty,

                                org.apache.cxf.resource,

                                META-INF.cxf,

                            +     *</Import-Package>+

                 

                Is it really necessary?  Am I missing something which avoids this?

                 

                -Eoin

                • 5. Re: cxf.xml configuration in Camel
                  Eoin Shanaghy Newbie

                  As a follow up to this, I eventually went with a custom cxf-appname.xml file, preventing conflict issues with cxf.xml.

                  This is then imported in my camel-context.xml

                   

                   

                   

                  The configuration now works in Fuse ESB 4.1.0.2 without any problems.