我使用了来自http://mvnrepository.com/artifact/org.eclipse.californium/californium-core/1.0.1的库 CoAP
当我运行下面的代码来添加端点时,我得到一个异常:
private void addEndpoints() {
for (InetAddress addr : EndpointManager.getEndpointManager().getNetworkInterfaces()) {
// only binds to IPv4 addresses and localhost
if (addr instanceof Inet4Address || addr.isLoopbackAddress()) {
System.out.println("addr: "+addr.toString());
InetSocketAddress bindToAddress = new InetSocketAddress(addr, COAP_PORT);
System.out.println("bindToAddress: "+bindToAddress.toString());
addEndpoint(new CoapEndpoint(bindToAddress));
}
}
}
这是例外:
2016 年 1 月 20 日下午 3:24:58 org.eclipse.californium.core.network.config.NetworkConfig createStandardWithFile 信息:在文件 Californium.properties 中存储标准属性
地址:/127.0.0.1 绑定地址:/127.0.0.1:5683
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/californium/elements/RawDataChannel
at HelloWorldServer.addEndpoints(HelloWorldServer.java:53)
at HelloWorldServer.main(HelloWorldServer.java:34)
Caused by: 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)
... 2 more
我在 GitHub Source org/eclipse/californium/elements/RawDataChannel.java 中没有看到任何文件,这是问题所在!?
我试图清理和重建项目仍然是同样的问题。再次创建项目,不工作
提前致谢