0

我正在遵循Eclipse Hono 入门指南并使用沙盒环境。

我打开 git bash 终端并使用此命令启动设备以接收命令:

mosquitto_sub -v -h $MQTT_ADAPTER_IP -u $MY_DEVICE@$MY_TENANT -P $MY_PWD -t command/+/+/req/#

我打开了另一个 git bash 终端,并使用此命令让应用程序客户端向设备发送命令:

java -jar hono-cli-*-exec.jar --hono.client.host=$AMQP_NETWORK_IP --hono.client.port=15672 --hono.client.username=consumer@HONO --hono.client.password=verysecret --tenant.id=$MY_TENANT --device.id=$MY_DEVICE --spring.profiles.active=command

但是当我使用上面的命令时,我得到了这个异常:

21:41:45.504 [main] INFO  org.eclipse.hono.cli.Application - Starting Application v1.3.0 on DESKTOP-4SV0QNN with PID 9768 (C:\Users\HP\hono-cli-1.3.0-exec.jar started by HP in C:\Users\HP)
21:41:45.509 [main] INFO  org.eclipse.hono.cli.Application - The following profiles are active: command
21:41:47.092 [main] INFO  org.eclipse.hono.cli.Application - running command line client in role(s): command
21:41:50.249 [main] INFO  org.eclipse.hono.cli.Application - Started Application in 7.064 seconds (JVM running for 10.127)
21:42:17.462 [vert.x-eventloop-thread-0] INFO  o.e.h.client.impl.HonoConnectionImpl - max number of attempts [5] to re-connect to server [hono.eclipseprojects.io:15672, role: unknown] have been made, giving up
21:42:17.595 [vert.x-eventloop-thread-0] INFO  o.e.h.client.impl.HonoConnectionImpl - stopping connection attempt to server [hono.eclipseprojects.io:15672, role: unknown] due to terminal error
org.eclipse.hono.connection.ConnectTimeoutException: connection attempt timed out after 5000ms
        at org.eclipse.hono.connection.impl.ConnectionFactoryImpl.lambda$connect$0(ConnectionFactoryImpl.java:153)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:923)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:887)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43)
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229)
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:221)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.run(VertxImpl.java:913)
        at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
        at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:834)
21:42:17.602 [vert.x-eventloop-thread-0] ERROR org.eclipse.hono.cli.app.Commander - Error: failed to connect

我在应用客户端设置了环境变量MQTT_ADAPTER_IP、MY_TENANT、MY_DEVICE,在设备端设置了MY_TENANT、MY_DEVICE、MY_PWD、MQTT_ADAPTER_IP。

这是我系统中的 jdk 版本:

C:\Users\HP>java -version
java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)

请告诉我如何解决这个问题。

4

1 回答 1

0

这是完整的输出 -

09:50:01.304 [main] INFO org.eclipse.hono.cli.Application - 在 PID 17404 的 DESKTOP-4SV0QNN 上启动应用程序 v1.3.0(C:\Users\HP\hono-cli-1.3.0-exec.jar由 HP 在 C:\Users\HP 中启动)09:50:01.309 [main] INFO org.eclipse.hono.cli.Application - 以下配置文件处于活动状态:command 09:50:02.587 [main] INFO org.eclipse。 hono.cli.Application - 在角色中运行命令行客户端:命令 09:50:05.739 [main] INFO org.eclipse.hono.cli.Application - 在 6.407 秒内启动应用程序(JVM 运行 7.463)09:50 :07.855 [vertx-blocked-thread-checker] WARN ivcore.impl.BlockedThreadChecker - 线程 Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5, main] 已被阻止 2415 毫秒,时间限制为 2000 毫秒 io.vertx.core.VertxException: 线程在 java.base@11.0.7/java.net.NetworkInterface 被阻止。getAll(Native Method) at java.base@11.0.7/java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:359) at io.netty.resolver.dns.DnsNameResolver.anyInterfaceSupportsIpV6(DnsNameResolver.java:158) at io。 netty.resolver.dns.DnsNameResolver.(DnsNameResolver.java:117) 在 io.netty.resolver.dns.DnsNameResolverBuilder.(DnsNameResolverBuilder.java:50) 在 io.netty.resolver.dns.DnsAddressResolverGroup.(DnsAddressResolverGroup.java:61) ) 在 io.vertx.core.impl.resolver.DnsResolverProvider$1.newResolver(DnsResolverProvider.java:137) 在 io.netty 的 io.vertx.core.impl.resolver.DnsResolverProvider$1$1.(DnsResolverProvider.java:137)。 resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:70) 在 io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:194) 在 io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:162) 在 io。netty.bootstrap.Bootstrap.connect(Bootstrap.java:139) 在 io.vertx.core.net.impl.ChannelProvider.handleConnect(ChannelProvider.java:140) 在 io.vertx.core.net.impl.ChannelProvider.connect( ChannelProvider.java:93) 在 io.vertx.core.net.impl.NetClientImpl.doConnect(NetClientImpl.java:211) 在 io.vertx.core.net.impl.NetClientImpl.doConnect(NetClientImpl.java:168) 在 io .vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:116) 在 io.vertx.proton.impl.ProtonClientImpl.connectNetClient(ProtonClientImpl.java:74) 在 io.vertx.proton.impl.ProtonClientImpl.connect (ProtonClientImpl.java:65) 在 org.eclipse.hono.connection.impl.ConnectionFactoryImpl.connect(ConnectionFactoryImpl.java:158) 在 org.eclipse.hono.client.impl.HonoConnectionImpl.lambda$connect$6(HonoConnectionImpl.java: 408)在 org.eclipse.hono.client.impl。HonoConnectionImpl$$Lambda$305/0x0000000100367c40.handle(Unknown Source) at org.eclipse.hono.util.HonoProtonHelper.lambda$executeOnContext$4(HonoProtonHelper.java:199) at org.eclipse.hono.util.HonoProtonHelper$$Lambda$306/ 0x0000000100367040.handle(Unknown Source) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38) at io .vertx.core.impl.EventLoopContext$$Lambda$307/0x0000000100367440.run(Unknown Source) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor。 runAllTask​​s(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) 在 io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 在 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 在 java.base@11.0.7/ java.lang.Thread.run(Thread.java:834) 09:50:33.520 [vert.x-eventloop-thread-0] 信息 oehclient.impl.HonoConnectionImpl - 最大尝试次数 [5] 重新连接到服务器[hono.eclipseprojects.io:15672,角色:未知] 已完成,放弃 09:50:33.526 [vert.x-eventloop-thread-0] 信息 oehclient.impl.HonoConnectionImpl - 停止尝试连接到服务器 [hono. eclipseprojects.io:15672,角色:未知] 由于终端错误 org.eclipse.hono.connection.ConnectTimeoutException:连接尝试在 org.eclipse.hono.connection.impl.ConnectionFactoryImpl.lambda$connect$0(ConnectionFactoryImpl. java:153) 在 io.vertx.core.impl。VertxImpl$InternalTimerHandler.handle(VertxImpl.java:923) 在 io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:887) 在 io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java: 366)在 io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) 在 io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229) 在 io.vertx.core.impl.ContextImpl .executeFromIO(ContextImpl.java:221) 在 io.vertx.core.impl.VertxImpl$InternalTimerHandler.run(VertxImpl.java:913) 在 io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98) 在io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170) 在 io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) 在 io.netty.util.concurrent.SingleThreadEventExecutor.runAllTask​​s( SingleThreadEventExecutor.java:472) 在 io.netty。channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap. java:74) 在 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 在 java.base/java.lang.Thread.run(Thread.java:834) 09:50:33.537 [vert. x-eventloop-thread-0] 错误 org.eclipse.hono.cli.app.Commander - 错误:连接失败x-eventloop-thread-0] 错误 org.eclipse.hono.cli.app.Commander - 错误:连接失败x-eventloop-thread-0] 错误 org.eclipse.hono.cli.app.Commander - 错误:连接失败

于 2020-08-10T09:02:57.870 回答