当我尝试创建一个新的MqttClient时,我从mqtt代理获得以下异常.错误在这里---
Caused by: Persistence already in use (32200)
at org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence.open(MqttDefaultFilePersistence.java:108) [mqtt-client-0.4.0.jar:]
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:273) [mqtt-client-0.4.0.jar:]
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:222) [mqtt-client-0.4.0.jar:]
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:134) [mqtt-client-0.4.0.jar:]
at com.ericsson.asdp.virtualassist.notification.messaging.MQTTHandler.createClient(MQTTHandler.java:61) [classes:]
at com.ericsson.asdp.virtualassist.notification.messaging.MQTTMessagingService.receieve(MQTTMessagingService.java:52) [classes:]
... 44 more
Run Code Online (Sandbox Code Playgroud)
这是receive()我尝试连接到mqtt的java类方法的代码---
MqttClient subClient = null;
try {
subClient = mqttHandler.createClient(userId, brokerURL);
MQTTNotificationSubscriber notificationSub = new MQTTNotificationSubscriber(mqttHandler);
notificationSub.setUserId(userId);
subClient.setCallback(notificationSub);
mqttHandler.subscribe(subClient, userId);
// do something here
} catch (Exception e) {
logger.error("Error in receive " + e.getMessage());
throw new VirtualAssistServicesException(e.getMessage(), e);
} finally {
try {
mqttHandler.disconnect(subClient);
} catch (MqttException e) …Run Code Online (Sandbox Code Playgroud) 我有一个与 couchbase 通信的 spring-boot 应用程序。我将 Spring 应用程序构建为 Docker 镜像。为了运行应用程序,需要在 couchbase 设置中满足一些先决条件。当我先运行 couchbase 映像,然后运行 spring-boot 应用程序映像时,一切运行正常。但是,我需要将其自动化并从 docker-compose 文件运行,这意味着通过单个 docker-compose up 命令我应该能够首先运行 couchbase 映像,使用所有预设对其进行配置,然后开始运行 spring-boot应用程序。我遇到了很多讨论线程,但不幸的是我无法让它以某种方式工作。我尝试使用 cmd 和入口点,但没有成功。这是我的 docker-compose 文件
version: "2"
services:
expensetracker-cb:
image: chakrar27/expensetracker-cb
command: sh test_hello.sh
ports:
- 8080:8080
depends_on:
- mycouchbase
mycouchbase:
image: chakrar27/couchbase_new_10_08_2016
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
Run Code Online (Sandbox Code Playgroud)
事实上它根本不会触发 test_hello.sh 。这是 spring-bootexpensetracker 应用程序的 dockerfile
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD expensetracker-cb-0.1.0.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?