you are missing to add the ProvisionActivator. See my other mail. regards,
Karl On Wed, Jan 6, 2010 at 1:27 PM, cmoulliard <[email protected]> wrote: > > I test the Apache Felix Servlet Bridge with an example where Apache Felix > Karaf is launched but Tomcat generates this error during initialization 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 ? > > Here is my config : > > <?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 ); > } > } > > } > > Regards, > > ----- > Charles Moulliard > SOA Architect > > My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ > -- > View this message in context: > http://old.nabble.com/Servlet-Bridge---Apache-Felix-Karaf---Tomcat-%21%21-tp27026840p27026840.html > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]

