-
Bug
-
Resolution: Done
-
Major
-
fuse-7.0.1
-
None
-
%
-
-
-
Fuse 7.3 Sprint 40 - Dev #1
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?