9 Replies Latest reply on Feb 16, 2009 7:50 AM by davsclaus

    camel-jetty in FUSE ESB 4

    quan_quan

      I am trying to use camel-jetty component in Fuse ESB 4.0.0.3 and get an error. I am new to Camel and might have not undstood or used it properly; here is what I did:

       

      1. I want to send a http request to http://0.0.0.0:8081/xyz/scheduling and get the message into my JBI service.

       

      2. I OSGi-installed camel-jetty-1.5.1.0-fuse.jar. It looks like camel-jetty-1.5.1.0-fuse.jar depends on camel-http-1.5.1.0-fuse.jar and commons-io-1.4.jar, so I downloaded the jars and installed them.

       

      2. I created a JBI SU using Camel. Here is my camel-context.xml:

         

       

      3. Created a JBI SA containing the Camel SU (and other SUs).

       

      4. When I deployed the SA into Fuse-ESB-4.0.0.3, I got the following error:

      org.apache.camel.NoSuchEndpointException: No endpoint could be found for: jetty:http://0.0.0.0:8081/di10/scheduling, please check your classpath contains the needed camel component jar.

           at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:55)

           at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:99)

           at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)

           at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)

           at org.apache.camel.model.FromType.resolveEndpoint(FromType.java:73)

           at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:81)

           at org.apache.camel.model.RouteType.addRoutes(RouteType.java:213)

           at org.apache.camel.model.RouteType.addRoutes(RouteType.java:89)

           at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:639)

           at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:631)

           at org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:167)

           at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:162)

           at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)

           at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:97)

       

       

      Does anyone see a problem? Could it be a bug of Fuse ESB? Thanks.

        • 1. Re: camel-jetty in FUSE ESB 4
          gertv

          L.S.,

           

          The problem is in mixing up OSGi and JBI packaging.  If you want to package your Camel route in a JBI SU, you have to add the dependency (i.c. camel-jetty) to the SU itself.  You can do this by adding it to the pom.xml file as a <dependency/>

           

          You can also deploy the camel-jetty component as an OSGi bundle as you did and then create another OSGi bundle containing the Camel route.  Make sure to import the necessary packages from your camel-jetty bundle into the camel route bundle.

           

          I have raised a JIRA on ServiceMix 4 (https://issues.apache.org/activemq/browse/SMX4NMR-67) so we can add this feature in a future release.

           

          Regards,

           

          Gert

          • 2. Re: camel-jetty in FUSE ESB 4
            quan_quan

            Gert,

             

            Thanks for your help. I made some progress following your suggestions, though not quite getting to where I'd like to be. Here's what I have done and the results:

             

            1. Declare the dependency on camel-jetty in the SU. The jbi-maven-plugin pulls all the dependent jetty jar files into my SU; this is ok, but the SA containing the SU isn't deployed properly. The error message says something like "a method in org.mortbay.thread.Timeout doesn't exist". I guess this is probably a result of mixing different versions of jetty and jetty-util jars in the environment.

             

            2. Create an OSGi bundle for the Camel route. This works fine for a route like

             

             

             

            Both the bundle and SA are deployed and started ok, and I can send http requests to http://xyz.com/xyzService, but the messages just don't reach jbi:service:xyz:xyzService.

             

            Do you see any problem in my configs or have further suggestions? Thanks again, I really appreciate your help.

            • 3. Re: camel-jetty in FUSE ESB 4
              olivern

              Hi -

               

              I have a similar issue trying to deploy a Camel-based application that uses the camel-jetty component in SMX 4.0.

               

              Basically, I have a simple test service that takes an XML message over HTTP and routes it to a POJO using Camel. It is all working fine when I use the Camel Maven plug in and execute 'mvn camel:run' to run the service.

               

              I added the Maven OSGi bundle plug-in configuration to the POM, and it looks like all the right information is being included in the MANIFEST.MF  (org.apache.camel.component.jetty in particular)

               

              -


               

              Manifest-Version: 1.0

              Export-Package: edu.mit.ll.fuse.examples.camel

              Private-Package: edu.mit.ll.fuse.examples.camel.simpleService

              Built-By: olivern

              Tool: Bnd-0.0.255

              Bundle-Name: MIT Lincoln Lab FUSE Examples - Camel

              Created-By: Apache Maven Bundle Plugin

              Bundle-Version: 1.0

              Build-Jdk: 1.6.0_06

              Bnd-LastModified: 1234742822065

              Bundle-ManifestVersion: 2

              Import-Package: edu.mit.ll.fuse.examples.camel,javax.xml.stream,org.ap

              ache.camel;version="1.5",org.apache.camel.component.http;version="1.5

              ",org.apache.camel.component.jetty;version="1.5",org.apache.camel.con

              verter.xmlbeans;version="1.5",org.apache.camel.osgi,org.apache.xmlbea

              ns;version="2.4",org.apache.xmlbeans.xml.stream;version="2.4",org.w3c

              .dom

              Bundle-SymbolicName: edu.mit.ll.fuse.examples.camel-http-pox-service

               

              -


               

               

              I have installed the camel-jetty, camel-http, and apache commons IO packages in

              my SMX 4.0 instance, and that seemed to work ok (though I have a separate question about

              how to control the order that they are loaded at startup by the SMX kernel).

               

               

              The camelConfig.xml file looks like:

               

              -


               

               

               

              -


               

               

              When I deploy the test service, all the normal OSGi package dependencies appear to

              get resolved ok, but I get the following error (same error as Quan in the original thread post)

               

               

              -


               

              Exception in thread "SpringOsgiExtenderThread-55" org.apache.camel.NoSuchEndpointException: No endpoint could be found for: jetty:http://localhost:8084/services/simpleService, please check your classpath contains the needed camel component jar.

                      at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:55)

                      at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:99)

                      at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)

                      at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)

                      at org.apache.camel.model.FromType.resolveEndpoint(FromType.java:73)

                      at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:81)

                      at org.apache.camel.model.RouteType.addRoutes(RouteType.java:213)

                      at org.apache.camel.model.RouteType.addRoutes(RouteType.java:89)

                      at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:639)

                      at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:631)

                      at org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:167)

                      at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:162)

               

               

               

              At this point, I've double-checked for typos, etc..., and can't find any problems. I haven't set any classpath up for the OSGi bundle, as it seems like this isn't needed in the case of OSGi (is that correct, or do I need to do something with the classpath in the case of Camel?)

               

              Any ideas would be much appreciated!

               

              Thanks,

               

              -Oliver

               

              P.S.  I am attaching a Tarball containing the whole test service Maven module in case that is useful.

               

              Edited by: olivern on Feb 16, 2009 12:52 AM

              • 4. Re: camel-jetty in FUSE ESB 4
                olivern

                Hi -

                 

                I enabled the DEBUG log level for servicemix and investigated this a bit further. From what I can tell, it looks like the camel-osgi module may not be being used for some reason, even though it is installed. From the logfile (attached), it seems like the plain-old 'org.apache.camel.spring.CamelContextFactoryBean' class is trying to find the camel-jetty component, rather than the OSGi-enabled version of the class ('org.apache.camel.osgi.CamelContextFactoryBean').  I never see any indication in the logfile that the OSGi version of CamelContextFactoryBean is actually instantiated, and that would certainly explain why the add-on component bundles like 'camel-jetty' are never getting recognized by Camel even though it looks like the bundles themselves start up ok in the OSGi container.

                 

                I don't understand the mechanism whereby the OSGi version of CamelContextFactoryBean is enabled to help find components, so I don't know where to look next - any help is appreciated!

                 

                -Oliver

                • 5. Re: camel-jetty in FUSE ESB 4
                  olivern

                  I'm not sure if this is exactly the correct solution, but I noticed that the camel-osgi bundle sets up its own camelContext schema with a different namespace that the 'base' spring schema. If  the ) since it does represent a different type - having the extended element use the same name as the base element is somewhat confusing.

                   

                  -Oliver

                   

                  -


                   

                   

                   

                  Edited by: olivern on Feb 16, 2009 11:22 AM

                  • 6. Re: camel-jetty in FUSE ESB 4
                    davsclaus

                    Hi Oliver

                     

                    Thanks for the feedback and the solution.

                     

                    I have created a ticket about your findings, so we wont forget about it

                    https://issues.apache.org/activemq/browse/CAMEL-1345

                    • 7. Re: camel-jetty in FUSE ESB 4
                      njiang

                      Hi Quan Feng

                       

                      It's looks like Camel can't find the JBI component in ESB4.

                      So which version of ESB4 are you using?

                       

                      Can you show me the detail camel-su files?

                       

                      Willem

                      • 8. Re: camel-jetty in FUSE ESB 4
                        olivern

                        Hi -

                         

                        I think this problem is consistent with the schema namespace issue CAMEL-1345

                         

                        Replacing

                         

                         

                         

                        may solve it.

                         

                        -Oliver

                        • 9. Re: camel-jetty in FUSE ESB 4
                          njiang

                          I did some works on the camel-osgi module,  all the camel osgi relates codes are in this module now.

                          If you are using the osgi target namespace, the osgi version of CamelContextFactoryBean will be used.

                           

                          Willem