ServletContext becomes unavailable on restart when using Whiteboard and CustomContexts

Description

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:
"HTTP ERROR 404

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

Environment

Java 1.8, 64-bit
Karaf 4.1.0

Status

Assignee

Grzegorz Grzybek

Reporter

Syferlock Support

Labels

None

Fix versions

Affects versions

6.0.2
6.0.3

Priority

Minor
Configure