java - ReSTLet 错误。无法运行以下服务器端任务 httpserver.serverimpl

标签 java restlet httpserver

我的智能手机收集 GPS、蓝牙日志,然后定期将数据发送到服务器。 我的服务器使用 ReSTLet 不断接收数据。 然而我遇到了一个我以前从未见过的错误,谷歌没有给出任何解决方案或提示。 (过去几天我的服务器运行良好。)

以下消息是我遇到的错误。

Unable to run the following server-side task: sun-net.httpserver.ServerImpl$Exchange@81a5dc Unable to run the following server-side task: sun-net.httpserver.ServerImpl$Exchange@~~~~~~ Unable to run the following server-side task: sun-net.httpserver.ServerImpl$Exchange@~~~~~~

以下是我的代码。

ReSTLetServerMain.java

public void restServer(){
  try{
    Component component = new Component();
    component.getServers().add(Protocol.HTTP, Integer.parseInt(Common.SERVER_PORT));
    component.getDefaultHost().attach(new ServerApplication());
    component.start();
  }catch(Exception e){
    e.printStackTrace();
  }

}

服务器应用程序.java

public class ServerApplication extends Application {
  public Restlet createInboundRoot() {
  Router router = new Router(getContext());

  router.attach("/dataprocessing1", xxx.class);
  router.attach("/dataprocessing2", yyy.class);

  return router;
}

最佳答案

尝试 ReSTLet 的 jetty 扩展 (org.reSTLet.extends.jetty)(而不是默认的)可能会很有趣。

只需在类路径中添加相应的 jar 文件,Jetty 将用作应用程序的底层服务器。

希望它能解决您的问题。 蒂埃里

关于java - ReSTLet 错误。无法运行以下服务器端任务 httpserver.serverimpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32774834/

相关文章:

java - Jetty 线程池和 sun.HttpServer session

Java 字符串以逗号分割

c# - 路由上的约束条目 'httpMethod' 必须具有字符串值

java - JSON jackson 将 hashmap 的类值读取为 LinkedHashMap

java - ReSTLet 条件路由到不同资源

java - 在 OSGi 中从 ReSTLet 启动 Jetty

java - 如何将reSTLet请求的json类型输入转换为POJO?

javascript - 使用 TypeScript 和 Express, View 不会呈现。相反,显示服务器文件

具有用于串行通信的 rxtx 组件的 Java 小程序

java - 抑制 Freemarker 模板错误