Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-9510

Exposing camel-servlet as OSGI service

    XMLWordPrintable

Details

    • % %
    • Hide

      1- Unzip fuse-karaf-7.0.0.fuse-000191-redhat-1 distribution.
      2- Install the camel-servlet feature.
      3- Put the servlet-service.xml file in the deploy folder.
      4- Put the camel-route.xml file in the deploy folder.
      5- Check the console output.

      Show
      1- Unzip fuse-karaf-7.0.0.fuse-000191-redhat-1 distribution. 2- Install the camel-servlet feature. 3- Put the servlet-service.xml file in the deploy folder. 4- Put the camel-route.xml file in the deploy folder. 5- Check the console output.
    • Fuse 7.3 Sprint 40 - Dev #1

    Description

      Trying to expose a camel-servlet endpoint as OSGi service (interface org.apache.camel.http.common.CamelServlet) made it in Camel 2.17.X is not possible in Camel 2.21.0. After artifact deployment the following exception is displayed:

      Caused by: org.apache.aries.proxy.FinalModifierException: The methods protected final void org.apache.camel.http.common.CamelServlet.service(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException in class org.apache.camel.http.common.CamelServlet are final.
              at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.getProxySubclass(ProxySubclassGenerator.java:112) ~[?:?]
              at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance(ProxySubclassGenerator.java:171) ~[?:?]
              at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:140) ~[?:?]
              at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:77) ~[?:?]
              at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:42) ~[?:?]
              at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:332) ~[?:?]
              at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:125) ~[?:?]
              ... 38 more
      

      After some research seems that since Camel release 2.18 the camel method "service" is "final" https://github.com/apache/camel/blob/master/components/camel-http-common/src/main/java/org/apache/camel/http/common/CamelServlet.java#L74.

      Changing from org.apache.camel.http.common.CamelServlet to javax.servlet.Servlet does not works neither as per DefaultHttpRegistry class requires the CamelServlet class in the "register" method https://github.com/apache/camel/blob/master/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/DefaultHttpRegistry.java#L97.

      How should be deployed the camel-servlet component as an OSGi service in Camel 2.21?

      Attachments

        1. camel-route.xml
          2 kB
        2. camel-route-2.xml
          2 kB
        3. deploy.tar.gz
          1 kB
        4. servlet-service.xml
          0.6 kB

        Activity

          People

            rhn-support-tasato Tadayoshi Sato
            emunoz@redhat.com Elkin Munoz
            Tomas Turek Tomas Turek
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: