users@grizzly.java.net

Running Grizzly on OSGi

From: niklas modin <niklas.modin_at_oracle.com>
Date: Wed, 21 Jul 2010 17:15:42 -0700

Hi all,

I'm trying to implement a few RESTful web services using jersey and
grizzly running on the Equinox
OSGi platform.

I've managed to install and start the grizzly-httpservice-bundle OSGi
bundle, and all the jersey bundles
that I need ... or so I thought.

I'm using the example found on the jersey site, so my code for deploying
my resource looks like this:

*/final String baseUri = "http://localhost:9998/";
final Map<String, String> initParams = new HashMap<String, String>();
initParams.put("com.sun.jersey.config.property.packages", "my.package.resources");
threadSelector = GrizzlyWebContainerFactory.create(baseUri, initParams);/*

I also have a resource in my bundle looking like this:

*/package my.package.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/helloworld")
public class SpsResource {

  @GET
  @Produces("text/plain")
  public String getClichedMessage() {
    // Return some cliched textual content
    return "Hello World";
  }
}/*

When running this, I get the following exception:
*
/java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
        at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:68)/*


It seems that grizzly-httpservice-bundle has a dependency to ASM, but I couldn't find
this in the osgi import part of the manifest file, and ClassVisitor is not packaged in the bundle.

Anyone out there who can give me a pointer on what I need to do ?


Cheers,
Niklas