ClassLoader in OSGi RESTful Jersey Application "No WebApplication provider is present"
===

All,
     I'm running into a few issues when trying to do a POC showing a RESTful Jersey application bundle.  I've successfully gotten Jersey to the point of adding the ServletContainer to the HttpService; however, upon doing that I get an error stating:

        com.sun.jersey.api.container.ContainerException: No WebApplication provider is present
        at com.sun.jersey.spi.container.WebApplicationFactory.createWebApplication(WebApplicationFactory.java:69)
        at com.sun.jersey.spi.container.servlet.ServletContainer.create(ServletContainer.java:392)
        at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.create(ServletContainer.java:307)
        at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:607)
        at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at org.apache.felix.http.base.internal.handler.ServletHandler.init(ServletHandler.java:55)
        at org.apache.felix.http.base.internal.handler.HandlerRegistry.addServlet(HandlerRegistry.java:65)
        at org.apache.felix.http.base.internal.service.HttpServiceImpl.registerServlet(HttpServiceImpl.java:95)

As I started looking through the code, I am seeing this is because of the way the provider is looked up through the current Thread's classpath.  I have added the following dependencies within maven, and have validated that they are embedded within the bundle (as well as verified their classes are available or properly loaded at runtime):

		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-servlet</artifactId>
			<version>1.13</version>
		</dependency>
		<dependency>
		    <groupId>com.sun.jersey</groupId>
		    <artifactId>jersey-client</artifactId>
		    <version>1.12</version>
		</dependency>
		<dependency>
		    <groupId>javax.ws.rs</groupId>
		    <artifactId>jsr311-api</artifactId>
		    <version>1.1.1</version>
		</dependency>

I can see the resource file at /META-INF/services/com.sun.jersey.spi.container.WebApplicationProvider of the jersey-server jar; however, that isn't being found at runtime.

Any thoughts as to why the classloader resource isn't being found at runtime out of the jersey-server jar?  I am somewhat new to OSGi, so I'm not sure whether there is something special I should be doing to get this to work.  Here is the code snippet of my bundle activator -- **note that I am embedding Jersey dependencies within my bundle and not importing it through OSGi.**

    public class Activator implements BundleActivator {
    
    	private HttpService httpService = null;
    
    	public synchronized void start(BundleContext context) {
    		System.out.println("Starting up streaming-api");
    
    		try 
    		{
    			ServiceReference reference = null;
    			
    			reference = context.getServiceReference(HttpService.class.getName());
    			this.httpService = (HttpService)context.getService(reference);
    			httpService.registerServlet("/streaming", new ServletContainer(JerseyApplication.class), getJerseyServletParams(), null);
    		} 
    		catch (Exception e) 
    		{
    			System.out.println("An error occurred while starting up! " + e.getMessage());
    			e.printStackTrace();
    		}
    	}
    
    	public synchronized void stop(BundleContext context) throws Exception {
    		System.out.println("Shutting down streaming-api");
    		
    		
    		if (httpService != null) {
    			httpService.unregister("/streaming");
    		}
    	}
    
    	private Dictionary<String, String> getJerseyServletParams() {
    		Dictionary<String, String> jerseyServletParams = new Hashtable<String, String>();
    //		jerseyServletParams.put("javax.ws.rs.Application", JerseyApplication.class.getName());
    		return jerseyServletParams;
    	}
    }