addEndpoints上的Californium CoAP服务器错误 [英] Californium CoAP Server Error on addEndpoints

查看:69
本文介绍了addEndpoints上的Californium CoAP服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从以下示例CoAP服务器程序之一 http://mvnrepository使用库CoAP.com/artifact/org.eclipse.californium/californium-core/1.0.1

当我在下面的代码中运行addEndpoints时,出现异常:

 私有无效addEndpoints(){对于(InetAddress addr:EndpointManager.getEndpointManager().getNetworkInterfaces()){//仅绑定到IPv4地址和本地主机如果(Inet4Address的addr instance || addr.isLoopbackAddress()){System.out.println("addr:" + addr.toString());InetSocketAddress bindToAddress =新的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 createStandardWithFileINFO:将标准属性存储在Californium.properties文件中

addr:/127.0.0.1bindToAddress:/127.0.0.1:5683

 线程主"中的异常java.lang.NoClassDefFoundError:org/eclipse/californium/elements/RawDataChannel在HelloWorldServer.addEndpoints(HelloWorldServer.java:53)在HelloWorldServer.main(HelloWorldServer.java:34)引起原因:java.lang.ClassNotFoundException:org.eclipse.californium.elements.RawDataChannel在java.net.URLClassLoader.findClass(未知来源)在java.lang.ClassLoader.loadClass(未知来源)在sun.misc.Launcher $ AppClassLoader.loadClass(未知来源)在java.lang.ClassLoader.loadClass(未知来源)...另外2个 

我在GitHub Source中看不到任何文件org/eclipse/californium/elements/RawDataChannel.java是问题!?

我试图清理并重建项目仍然存在相同的问题.再次创建了项目,不起作用

预先感谢

解决方案

答案很旧,尽管答案可能对某人有用.

缺少元素连接器库.我建议使用Maven并将作为依赖项添加到pom.xml

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

I have used library CoAP from http://mvnrepository.com/artifact/org.eclipse.californium/californium-core/1.0.1

When I run below code to addEndpoints, I get an exception:

 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

addr: /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 !?

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

这篇关于addEndpoints上的Californium CoAP服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆