1
votes

Im trying to accomplish a secure REST-server with grizzly using SSL. I configure my ressources in

package SPSServer.controller.Grizzly;
@Path("/")
public class MessageRessource {

@GET
@Path("serverinfo")
@Produces({MediaType.APPLICATION_JSON,MediaType.TEXT_XML})
public ServerInfo serverinfo() {
    ServerInfo info = new ServerInfo();
    info.server = System.getProperty("os.name") + " " + System.getProperty("os.version");
    return info;
}



@GET
@Produces({MediaType.APPLICATION_JSON,MediaType.TEXT_XML})
//@Produces( MediaType.TEXT_PLAIN )
public String message() {
    return "Yea! ";
}
}

Now im starting grizzly with

    webServer = new GrizzlyWebServer(1337, ".", true);
    SSLConfig sslConfig = new SSLConfig(true);
    webServer.setSSLConfig(sslConfig);
    ServletAdapter adapter = new ServletAdapter();
    final Map<String, String> initParams = new HashMap<String, String>();
    adapter.addInitParameter(PackagesResourceConfig.PROPERTY_PACKAGES,    "SPSServer.controller.Grizzly.MessageRessource");
           adapter.addInitParameter(ClasspathResourceConfig.PROPERTY_CLASSPATH, ".");

    adapter.setContextPath("/");
    adapter.setServletInstance(new ServletContainer());

     webServer.addGrizzlyAdapter(adapter, new String[]{"/"});
     webserver.start();

`

It start with

Mar 31, 2013 4:55:14 PM com.sun.grizzly.Controller logVersion INFO: GRIZZLY0001: Starting Grizzly Framework 1.9.56 - 3/31/13 4:55 PM Hit return to stop...

But when i try to access the ressource / '(https://locahost:1337/)' it throws me this error:

Mar 31, 2013 4:56:12 PM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Scanning for root resource and provider classes in the packages: SPSServer.controller.Grizzly.MessageRessource Mar 31, 2013 4:56:12 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Initiating Jersey application, version 'Jersey: 1.17.1 02/28/2013 03:28 PM' Mar 31, 2013 4:56:13 PM com.sun.jersey.server.impl.application.RootResourceUriRules SEVERE: The ResourceConfig instance does not contain any root resource classes. Mar 31, 2013 4:56:13 PM com.sun.grizzly.http.servlet.ServletAdapter doService SEVERE: service exception: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

I have tried getting grizzly to work (with the jersey HttpServerFactory i get an working rest-server without ssl, and i managed to get an httpsServer working but both combined got me an headache for days now) so now i really depend on your help. Thanks in advance (I take no offence if someone corrects my grammar, i still have to learn it)

1

1 Answers