MQTT connection error on 2021b - Unable to resolve the name com.mathworks.mqttclient.client.Client.
조회 수: 13 (최근 30일)
이전 댓글 표시
I'm facing this error while trying to create an mqtt connection:
>> myMQTT=mqtt('tcp://broker.hivemq.com')
'com.mathworks' package and subpackages will be removed in a future release. There is no simple replacement for this.
Caused by:
Unable to resolve the name com.mathworks.mqttclient.client.Client.
I'm using matlab 2021b:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.11.0.2358333 (R2021b) Update 7
MATLAB License Number:
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.11 (R2021b)
Database Toolbox Version 10.2 (R2021b)
Deep Learning Toolbox Version 14.3 (R2021b)
Image Acquisition Toolbox Version 6.5 (R2021b)
Image Processing Toolbox Version 11.4 (R2021b)
MATLAB Compiler Version 8.3 (R2021b)
MATLAB Compiler SDK Version 6.11 (R2021b)
MATLAB Report Generator Version 5.11 (R2021b)
Spreadsheet Link Version 3.4.6 (R2021b)
Statistics and Machine Learning Toolbox Version 12.2 (R2021b)
댓글 수: 0
답변 (1개)
Samay Sagar
2024년 8월 27일
Hi Eduardo,
I have faced a similar issue in the past. To address this issue while trying to create an MQTT connection you need to ensure that the necessary Java Archive (JAR) files are included in the dynamic Java class path. . You can use the “javaaddpath” function to add entries to dynamic Java class path.
javaaddpath(path_to_mqttasync.jar)
javaaddpath(path_to_org.eclipse.paho.client.mqttv3-1.1.0.jar)
To verify that the JAR files were added correctly, run the “javaclasspath” command in MATLAB command window. This will display the current Java class paths, and you should see your JAR files listed under "Dynamic Java Path."
You can now try to establish a MQTT connection.
myMQTT=mqtt('tcp://broker.hivemq.com')
For more information about “javaaddpath” and “javaclasspath” refer the following documentation:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!