Hi Charles,

I think if you can make sure the servlet is deployed before the camel context started, the camel-servlet endpoint can get the access the CamelHttpTransportServlet instance. As the CamelHttpTransportServlet and Karaf are using the same classloader, I think it should be OK for camel-servlet endpoint accessing the CamelHttpTransportServlet instance.

If you extends the CamelHttpTransportServlet and load the Karaf when the Servlet start, maybe we can workaround the camelContext starting issue.

Willem

Charles Moulliard wrote:
Hi,

I have packaged my OSGI project including camel context in a WAR file. This
WAR file contains Felix Karaf server which is started by the Tomcat Web
Application Server though a bundle activator.

My camel context uses camel-servlet endpoint to have access to servlet
published by Tomcat

        <camel:route>
            <camel:from uri="servlet:///?matchOnUriPrefix=true" />
            <camel:to uri="cxfbean:restFulService" />
        </camel:route>

Question :

Can the camel-servlet endpoint (bundle started by karaf) retrieve the
servlet org.apache.camel.component.servlet.CamelHttpTransportServlet if this
one is created by Tomcat ?

<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
">

  <listener>

<listener-class>org.apache.felix.karaf.web.WebAppListener</listener-class>
  </listener>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <servlet>
    <servlet-name>CamelServlet</servlet-name>
    <display-name>Camel Http Transport Servlet</display-name>

<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CamelServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>


</web-app>


I don't think so because classloading of osgi cannot see what tomcat loads.

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm



Reply via email to