Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: modbus-tcp java.lang.NoSuchMethodError #1944

Open
2 of 16 tasks
rooterWzs opened this issue Dec 20, 2024 · 1 comment
Open
2 of 16 tasks

[Bug]: modbus-tcp java.lang.NoSuchMethodError #1944

rooterWzs opened this issue Dec 20, 2024 · 1 comment
Labels

Comments

@rooterWzs
Copy link

What happened?

String ip = "127.0.0.1";
String port = "503";
// 单元标识符:相当于设备的地址
String unitIdentifier = "1";
String timeout = "5000";
String urlFormat = "modbus-tcp:tcp://{}:{}?unit-identifier={}&request-timeout={}";
// try里面会自动关闭连接
try (PlcConnection plcConnection = PlcDriverManager
.getDefault()
.getConnectionManager()
.getConnection(StringUtils.format(urlFormat, ip, port, unitIdentifier, timeout)))

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.FieldUtils.getAllFields(Ljava/lang/Class;)[Ljava/lang/reflect/Field;
at org.apache.plc4x.java.spi.configuration.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:85)
at org.apache.plc4x.java.spi.configuration.ConfigurationFactory.createConfiguration(ConfigurationFactory.java:62)
at org.apache.plc4x.java.spi.connection.GeneratedDriverBase.getConnection(GeneratedDriverBase.java:324)
at org.apache.plc4x.java.spi.connection.GeneratedDriverBase.getConnection(GeneratedDriverBase.java:293)
at org.apache.plc4x.java.DefaultPlcDriverManager.getConnection(DefaultPlcDriverManager.java:79)
at com.plc.lib.driver.plc.modbus.ModbusExample.main(ModbusExample.java:35)

Version

0.13.0-SNAPSHOT

Programming Languages

  • plc4j
  • plc4go
  • plc4c
  • plc4net

Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7
@rooterWzs rooterWzs added the bug label Dec 20, 2024
@chrisdutz
Copy link
Contributor

It seems that the build is complaining about FieldUtils.getAllFields not existing in your lib. This however is part of commons-lang3 ... could it be that you are explicitly importing commons-lang3 in a version that doesn't have getAllFields? The API documentation says it exists since version 3.2 ... so are you possibly using an older version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants