Hi all,
I'm currently working on a servlet running an embedded framework using the 
servlet bridge.
OSGi is fairly new for me, I recently finished reading my first book regarding 
OSGi.
But let's see what my problem is.
I started by just building the example servlet bridge from the felix-docs 
(http://svn.apache.org/repos/asf/felix/trunk/http/samples/bridge/) after 
updating the dependencies to the most recent versions and adding some extra 
bundles to run my plugin.
After building the war-file and deploying it to a Tomcat application server 
v8.0 the frameworks seems to start correctly, so no missing dependencies e.g.
But if I try to access my servlet (that just prints "Hello World" to the 
browser) I just receive the following exception:

20-Dec-2018 14:04:52.116 SEVERE [http-nio-8080-exec-6] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for 
servlet [proxy] in context with path [/CoreRunner] threw exception [Bundle 
context attribute [org.osgi.framework.BundleContext] not set in servlet 
context] with root cause
javax.servlet.ServletException: Bundle context attribute 
[org.osgi.framework.BundleContext] not set in servlet context

I inspected the corresponding source code a little bit. When the exception is 
thrown the proxy servlet tries to get the bundle context object from the 
servlet context attributes, but it does not seem to be there (obviously).
That irritates me a little bit, as the bundle context is set in the first line 
of the start method in the provision activator.

When I try to run my servlet in a standalone framework everything works fine. 
So the problem is definitely not my servlet, but the bridge.

Was there a recent change made to the bridge, that made the example stopped 
working?
Any other thoughts?

Kind regards
Bernd

Reply via email to