Hi Karl,
thanks for your response!
My source code is the exact same as in the example, with one exception: I am 
using the WebListener-annotation to register the listener StartupListener. The 
example registers the listener in web.xml.

Kind regards,

-----Urspr√ľngliche Nachricht-----
Von: Karl Pauls [mailto:karlpa...@gmail.com] 
Gesendet: Donnerstag, 20. Dezember 2018 14:44
An: users@felix.apache.org
Betreff: Re: Problems using the servlet bridge

It should be set by the listener:
(which creates the FramworkService that in turn sets the context
property). Did you maybe not keep the provided web.xml?



On Thu, Dec 20, 2018 at 2:28 PM Bernd Foersterling
<foersterl...@pro-crm.de> wrote:
> 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

Karl Pauls

To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to