我正在尝试使用来自http://mvnrepository.com/artifact/org.eclipse.californium/californium-core/1.0.1的 Java 库设置 CoAP 服务器
public class HelloWorldServer extends CoapServer {
private static final int COAP_PORT = 5683;
/*
* Application entry point.
*/
public static void main(String[] args) {
try {
// create server
HelloWorldServer server = new HelloWorldServer();
// add endpoints on all IP addresses
server.addEndpoint(new CoAPEndpoint(new InetSocketAddress("127.0.0.1", COAP_PORT)));
server.start();
} catch (SocketException e) {
System.err.println("Failed to initialize server: " + e.getMessage());
}
}
将端点添加到服务器导致以下异常:
线程“main”中的异常 java.lang.NoClassDefFoundError: org/eclipse/californium/elements/RawDataChannel at com.landisgyr.chardonnay.HelloWorldServer.main(HelloWorldServer.java:35) 原因:java.lang.ClassNotFoundException: org.eclipse .californium.elements.RawDataChannel at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader .loadClass(Unknown Source) ... 1 更多
有没有人去 CoAP 服务器使用 Californium Java 库?