简体   繁体   English

addEndpoints上的Californium CoAP服务器错误

[英]Californium CoAP Server Error on addEndpoints

I am trying one of example CoAP server program from https://github.com/eclipse/californium.core/tree/master/cf-helloworld-server/src/main/java/org/eclipse/californium/examples/HelloWorldServer.java 我正在尝试https://github.com/eclipse/californium.core/tree/master/cf-helloworld-server/src/main/java/org/eclipse/californium/examples/HelloWorldServer中的示例CoAP服务器程序之一。爪哇

I have used library CoAP from http://mvnrepository.com/artifact/org.eclipse.californium/californium-core/1.0.1 我已经从http://mvnrepository.com/artifact/org.eclipse.californium/californium-core/1.0.1使用了库CoAP

When I run below code to addEndpoints, I get an exception: 当我在下面的代码中运行addEndpoints时,出现异常:

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

Here is the Exception: 这是例外:

Jan 20, 2016 3:24:58 PM org.eclipse.californium.core.network.config.NetworkConfig createStandardWithFile INFO: Storing standard properties in file Californium.properties 2016年1月20日3:24:58 PM org.eclipse.californium.core.network.config.NetworkConfig createStandardWithFile信息:将标准属性存储在文件Californium.properties中

addr: /127.0.0.1 bindToAddress: /127.0.0.1:5683 地址:/127.0.0.1 bindToAddress:/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

I see no file in GitHub Source org/eclipse/californium/elements/RawDataChannel.java is that is the problem !? 我在GitHub Source org / eclipse / californium / elements / RawDataChannel.java中没有找到任何文件!

I tried to clean and rebuild the project still same issue. 我试图清理和重建项目仍然是同样的问题。 Created project again, don't work 再次创建了项目,不起作用

Thanks in advance 提前致谢

The answer is old, though maybe the answer will be useful for someone.. 答案是旧的,尽管答案可能对某人有用。

There was lack of element-connector library. 缺少元素连接器库。 I'd recommend to use Maven and add californium as a dependency to pom.xml 我建议使用Maven并添加for作为pom.xml的依赖项

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

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