kochedykov / jlibmodbus

JLibModbus - is an implementation of the Modbus protocol v1.1b in java language. Java modbus library. It works. Welcome.
http://kochedykov.github.io/jlibmodbus/
Apache License 2.0
299 stars 128 forks source link

Error when connecting to Modbus RTU and connecting with jSerialComm #93

Closed kk99999 closed 5 months ago

kk99999 commented 8 months ago

I am creating Modbus RTU and trying to connect using jSerialComm. I am getting below error though the method exists in jSerialComm.

java.lang.NoSuchMethodError: 'void com.fazecast.jSerialComm.SerialPort.setComPortParameters(int, int, int, int)'

I verified that there is only one version of jSerialComm(2.10.4) library. Below is the code to connect. SerialParameters serialParameters = new SerialParameters("COM1", SerialPort.BaudRate.BAUD_RATE_9600, 8, 1, SerialPort.Parity.EVEN); SerialUtils.setSerialPortFactoryJSerialComm(); ModbusMasterFactory.createModbusMasterRTU().connect();

Any thoughts?

kk99999 commented 7 months ago

I am seeing this issue with jSerialComm versions > 2.6.0. If using 2.6.0 and earlier version I don't see this issue. Any chance this can be verified and may be resolved? jLibModbus version is 1.2.9.7.

kochedykov commented 7 months ago

Just testet with JSerialComm v2.10.4. Everything is OK.

divjad--- commented 6 months ago

@kochedykov Hi, for me this error still persists. I am using jLibModbus v1.2.9.9 and jSerialComm v2.10.4.

kochedykov commented 6 months ago

Hi! Show me the error log.

чт, 14 мар. 2024 г. в 19:00, David Trafela @.***>:

@kochedykov https://github.com/kochedykov Hi, for me this error still persists. I am using jLibModbus v1.2.9.9 and jSerialComm v2.10.4.

— Reply to this email directly, view it on GitHub https://github.com/kochedykov/jlibmodbus/issues/93#issuecomment-1997528006, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADNOPD6XKETM4Z565CN4733YYGUORAVCNFSM6AAAAABCEFYRB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXGUZDQMBQGY . You are receiving this because you were mentioned.Message ID: @.***>

-- Best,

Vladislav Kochedykov, CTO at JSC Invertor Factory phone: +79123539677 email: @. email: @.

divjad--- commented 5 months ago

Yes, here is the error log:

Caused by: java.lang.NoSuchMethodError: 'void com.fazecast.jSerialComm.SerialPort.setComPortParameters(int, int, int, int)' at com.intelligt.modbus.jlibmodbus.serial.SerialPortJSerialComm.open(SerialPortJSerialComm.java:71) at com.intelligt.modbus.jlibmodbus.net.ModbusConnectionSerial.openImpl(ModbusConnectionSerial.java:60) at com.intelligt.modbus.jlibmodbus.net.ModbusConnection.open(ModbusConnection.java:45) at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connectImpl(ModbusMaster.java:76) at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connect(ModbusMaster.java:90) *...omitted* at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95) ... 45 more

kochedykov commented 5 months ago
image

Did you add the jSerialComm path to classpath?

Yes, here is the error log:

Caused by: java.lang.NoSuchMethodError: 'void com.fazecast.jSerialComm.SerialPort.setComPortParameters(int, int, int, int)' at com.intelligt.modbus.jlibmodbus.serial.SerialPortJSerialComm.open(SerialPortJSerialComm.java:71) at com.intelligt.modbus.jlibmodbus.net.ModbusConnectionSerial.openImpl(ModbusConnectionSerial.java:60) at com.intelligt.modbus.jlibmodbus.net.ModbusConnection.open(ModbusConnection.java:45) at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connectImpl(ModbusMaster.java:76) at com.intelligt.modbus.jlibmodbus.master.ModbusMaster.connect(ModbusMaster.java:90) *...omitted* at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95) ... 45 more

divjad--- commented 5 months ago

Yes, it is added to the classpath, library is also found inside the packed JAR.

divjad--- commented 5 months ago

Hi, just a note. This issue seems to be resolved when updating jSerialComm to the latest version inside jlibmodbus. And also jlibmodbus version 1.2.9.11 from Maven Central seems to resolve this issue.

kochedykov commented 5 months ago

Ok, closed!