我的智能手机收集 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/