繁体   English   中英

带有灰熊的SSL-REST-server,ResourceConfig实例不包含任何根资源类

[英]SSL-REST-server with grizzly, ResourceConfig instance does not contain any root resource classes

我试图通过使用SSL来实现安全的REST服务器。 我在配置我的资源

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! ";
}
}

现在我开始与灰熊

    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();

`

它开始于

2013年3月31日,下午4:55:14 com.sun.grizzly.Controller logVersion信息:GRIZZLY0001:正在启动Grizzly Framework 1.9.56-13/3/31 4:55 PM点击返回以停止...

但是当我尝试访问资源/ '(https://locahost:1337/)' ,我抛出此错误:

2013年3月31日,下午4:56:12 com.sun.jersey.api.core.PackagesResourceConfig初始化信息:扫描软件包中的根资源和提供程序类:SPSServer.controller.Grizzly.MessageRessource 2013年3月31日,下午4:56:下午12点com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO:正在启动Jersey应用程序,版本“泽西:1.17.1 02/28/2013 03:28 PM” 2013年3月31日下午com .sun.jersey.server.impl.application.RootResourceUriRules严重:ResourceConfig实例不包含任何根资源类。 2013年3月31日,下午4:56:13 com.sun.grizzly.http.servlet.ServletAdapter doService严重:服务异常:com.sun.jersey.api.container.ContainerException:ResourceConfig实例不包含任何根资源类。

我已经试过让灰熊工作了(有了球衣HttpServerFactory,我得到了一个没有ssl的正常工作的休息服务器,我设法使httpsServer正常工作,但是现在两者合起来让我头疼了几天),所以现在我真的取决于您的帮助了。 在此先感谢(如果有人纠正我的语法,我不会冒犯,但我仍然必须学习它)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM