ServletContext becomes unavailable on restart when using Whiteboard and CustomContexts


When developing with the whiteboard-extender with or without DS, the HttpContext is lost when stopping and starting the servlet bundle. This prevents the servlet from being accessed again until the entire framework is stopped and started.

Able to show the Pax example whiteboard-ds shows this behavior as well.

Steps to Reproduce:

  • install fresh Karaf 4.1.0 and start it

  • from Karaf shell:
    feature:install pax-http-whiteboard (this is 6.0.2, but 6.0.3 fails as well)
    feature:install webconsole

  • from Karaf webconsole, install whiteboard-ds-6.0.3-SNAPSHOT.jar (compiled from sources)

displays "Hello from ServletWithContext" as expected

  • from Karaf webconsole or shell, stop and start whiteboard-ds bundle

navigate to http://localhost:8181/context/servlet again

receive this:

Problem accessing /context/servlet. Reason:

Not Found"

with this in the logs - the only warning or error that jumped out:

2017-03-14 19:46:34,896 | WARN | qtp289012751-105 | HttpServiceStopped | 98 - org.ops4j.pax.web.pax-web-runtime - 6.0.2 | Http service has already been stopped


Java 1.8, 64-bit
Karaf 4.1.0


Grzegorz Grzybek
June 5, 2017, 2:01 PM

are you working on this? Recently I added tests that install 2 WARs, test the requests and then stop one of them to check if server is still running (org.ops4j.pax.web.itest.jetty.WarExtendedIntegrationTest#testWars)

Grzegorz Grzybek
June 5, 2017, 2:04 PM

Doesn't org.ops4j.pax.web.itest.jetty.WhiteboardDSRestartIntegrationTest#testWhiteBoardSampleBundleRestart implement the case? This test works for me.

Achim Nierbeck
June 5, 2017, 4:17 PM

This issue isn't about Wars, but about Whiteboard, and yes that test does work.
The question why this one is still open, if there are regressions caused by the fix.

Grzegorz Grzybek
June 5, 2017, 6:40 PM

I'll try to have a look at similar, open issues soon.

Achim Nierbeck
November 12, 2017, 9:00 PM



Grzegorz Grzybek


Syferlock Support



Fix versions

Affects versions