Hi Configure it as a <bean id="servlet" class="...ServletComponent"> where you can set the servlet name as a property
On Sun, Nov 12, 2017 at 8:58 PM, JT <karaf-u...@avionicengineers.com> wrote: > Hi, > > I am trying to create two independent Camel Contexts with Camel blueprint > (as two separate bundles) that will be deployed into the same OSGi > container, exactly the same as described here: > > https://stackoverflow.com/questions/40271292/duplicate-servletname-detected-in-apache-camel-blueprint-based-osgi-bundles > > I also have encountered the same issue as described in that question, namely > that the two CamelHttpTransportServlet instances are created with the same > default name of 'CamelServlet'. The obvious solution is to set the > servletName as a property to OsgiServletRegisterer however this then results > in a HTTP 404 error when one of the URLs is called. > > I've traced it down to the ServletComponent class. It has a 'servletName' > property that is set to 'CamelServlet' by default thus is registered in > HttpRegistry under a different name to that specified to the > OsgiServletRegisterer. I've verified this by debugging around the creation > of Servletcomponent and manually setting the same setting name - I no longer > get the 404 error. > > The solution seems to therefore be to configure the servletName on the > ServletComponent but I cannot find anyway to do this. I've referred to: > > http://camel.apache.org/servlet.html > > where it describes a 'servletName' option but cannot specify this in my > blueprint XML file, eg the '<restConfiguation>' tag doesn't take such an > attribute nor can I specify it as a property. > > Is there a way, using the blueprint XML I can specify the 'servletName'? > > Thanks, Kerry > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2