It gets added in: http://svn.apache.org/repos/asf/felix/trunk/http/samples/bridge/src/main/java/org/apache/felix/http/samples/bridge/ProvisionActivator.java
which is passed to the framework in: http://svn.apache.org/repos/asf/felix/trunk/http/samples/bridge/src/main/java/org/apache/felix/http/samples/bridge/FrameworkService.java look for the createConfig method. regards, Karl On Wed, Jan 6, 2010 at 12:41 PM, Charles Moulliard <[email protected]> wrote: > My example is quite similar to the ServletListener of Bridge example but > uses Apache Felix Karaf > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application > 2.3//EN" > "http://java.sun.com/dtd/web-app_2_3.dtd"> > <web-app> > > <listener> > > <listener-class>org.apache.felix.http.samples.bridge.StartupListener</listener-class> > </listener> > > <servlet> > <servlet-name>proxy</servlet-name> > > <servlet-class>org.apache.felix.http.proxy.ProxyServlet</servlet-class> > <load-on-startup>1</load-on-startup> > </servlet> > > <servlet-mapping> > <servlet-name>proxy</servlet-name> > <url-pattern>/*</url-pattern> > </servlet-mapping> > > </web-app> > > *WebAppListener class :* > > import java.io.File; > > import javax.servlet.ServletContextEvent; > import javax.servlet.ServletContextListener; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > import org.apache.felix.karaf.main.Main; > import org.apache.felix.karaf.main.Bootstrap; > > public class WebAppListener implements ServletContextListener { > > private static final transient Log LOG = > LogFactory.getLog(WebAppListener.class); > > private Main main; > > public void contextInitialized(ServletContextEvent sce) { > try { > LOG.info("contextInitialized"); > String root = new File(sce.getServletContext().getRealPath("/") > + "WEB-INF/karaf").getAbsolutePath(); > LOG.info("Root: " + root); > System.setProperty("karaf.home", root); > System.setProperty("karaf.base", root); > System.setProperty("karaf.startLocalConsole", "false"); > System.setProperty("karaf.startRemoteShell", "true"); > main = Bootstrap.launch(new String[0]); > } catch (Exception e) { > main = null; > LOG.error( e ); > } > } > > public void contextDestroyed(ServletContextEvent sce) { > try { > LOG.info("contextDestroyed"); > if (main != null) { > main.destroy(false); > } > } catch (Exception e) { > LOG.error( e ); > } > } > > } > > The FrameWorkService class called by the StartupListener class of bridge > example starts Felix but I don't see that the BundleContext is added. > Question : Is the bundleContext created and added automatically by Felix > when started ? > > 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 > > > On Wed, Jan 6, 2010 at 12:32 PM, Karl Pauls <[email protected]> wrote: > >> Make sure you follow all the steps described in the link plus maybe >> look at the example: >> http://svn.apache.org/repos/asf/felix/trunk/http/samples/bridge/ >> >> it sounds like you didn't do the servletlistener that starts the >> framework and sets the context. >> >> (the process is not super automated atm and involves a couple of steps >> so don't give up to easily :-) >> >> regards, >> >> Karl >> >> On Wed, Jan 6, 2010 at 12:17 PM, Charles Moulliard <[email protected]> >> wrote: >> > Many thanks. >> > >> > I test it with my example but Tomcat generates this error during >> > initialisation of the proxy bridge servlet --> >> > >> > javax.servlet.ServletException: Bundle context attribute >> > [org.osgi.framework.BundleContext] not set in servlet context >> > at >> > >> org.apache.felix.http.proxy.ProxyServlet.getBundleContext(ProxyServlet.java:81) >> > at >> org.apache.felix.http.proxy.ProxyServlet.doInit(ProxyServlet.java:50) >> > at org.apache.felix.http.proxy.ProxyServlet.init(ProxyServlet.java:39) >> > at >> > >> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) >> > at >> > >> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806) >> > at >> > >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) >> > at >> > >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) >> > at >> > >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) >> > at >> > >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >> > at >> > >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >> > at >> > >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) >> > at >> > >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) >> > at >> > >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) >> > at >> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) >> > at java.lang.Thread.run(Thread.java:619) >> > >> > How the ProxyServlet retrieves such bundleContext ? >> > >> > 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 >> > >> > >> > On Wed, Jan 6, 2010 at 12:09 PM, Karl Pauls <[email protected]> wrote: >> > >> >> Yup: >> >> >> >> >> >> >> http://felix.apache.org/site/apache-felix-http-service.html#ApacheFelixHTTPService-UsingtheServletBridge >> >> >> >> regards, >> >> >> >> Karl >> >> >> >> On Wed, Jan 6, 2010 at 11:15 AM, Charles Moulliard < >> [email protected]> >> >> wrote: >> >> > Hi, >> >> > >> >> > Is there a servlet bridge available for Apache Felix like we have with >> >> > equinox --> >> http://www.eclipse.org/equinox/server/http_in_container.php? >> >> > >> >> > 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 >> >> > >> >> >> >> >> >> >> >> -- >> >> Karl Pauls >> >> [email protected] >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [email protected] >> >> For additional commands, e-mail: [email protected] >> >> >> >> >> > >> >> >> >> -- >> Karl Pauls >> [email protected] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > -- Karl Pauls [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

