Kafka - PLC4X - Modbus/TCP - Exception during scraping of Job

411 views Asked by At

I'm implementing apatche kafka(2.13-3.1.0) PLC4x connector to communicate with a PLC (Allen-Bradly - 1756-L83E ControlLogix 5580 controller), but I keep getting the following:

[2022-04-01 21:40:09,621] INFO [plc-modbus-source|task-0] Configuring Bootstrap with Configuration{} (org.apache.plc4x.java.transport.tcp.TcpChannelFactory:60)
[2022-04-01 21:40:10,614] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-heartbeat, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:11,636] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-dashboard, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:12,617] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-heartbeat, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:13,646] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-dashboard, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:14,623] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-heartbeat, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:15,648] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-dashboard, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:16,626] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-heartbeat, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:17,654] WARN [plc-modbus-source|task-0] Exception during scraping of Job modbus-dashboard, Connection-Alias machineA: Error-message: null - for stack-trace change logging to DEBUG (org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperTask:148)
[2022-04-01 21:40:18,137] INFO [plc-modbus-source|task-0|offsets] WorkerSourceTask{id=plc-modbus-source-0} Either no records were produced by the task since the last offset commit, or every record has been filtered out by a transformation or dropped due to transformation or conversion errors. (org.apache.kafka.connect.runtime.WorkerSourceTask:484)

my "plc4x-source.properties" look like this:

#-----Kafka Specific properties.
name=plc-modbus-source
connector.class=org.apache.plc4x.kafka.Plc4xSourceConnector
default.topic=connect-test
tasks.max=2

#----PLC4X specific properties
#List of source names. Each source is a specification for a device.
#It can containg mulitple job references
sources=machineA

#The PLC4X connection string to be used. Examples for each protocol are included on the PLC4X website.
sources.machineA.connectionString=modbus:tcp://192.168.110.2:502

#The source 'poll' method should return control to Kafka Connect every so often.
#This value controls how often it returns when no messages are received.
sources.machineA.pollReturnInterval=5000

#There is an internal buffer between the PLC4X scraper and Kafka Connect.
#This is the size of that buffer.
sources.machineA.bufferSize=10000

#A list of jobs associated with this source.
sources.machineA.jobReferences=modbus-heartbeat,modbus-dashboard

#The Kafka topic to use to produce to. The default topic will be used if this isn't specified.
sources.machineA.jobReferences.modbus-heartbeat.topic=heartbeat

#A list of jobs specified in the following section.
jobs=modbus-heartbeat,modbus-dashboard

#The poll rate for this job. the PLC4X scraper will request data every interval (ms).
jobs.modbus-heartbeat.interval=500

#A list of fields. Each field is a map between an alias and a PLC4X address.
#The address formats for each protocol can be found on the PLC4X website.

jobs.modbus-heartbeat.fields=BOOL1,BOOL2,BOOL3,Analog0,Analog1,Analog2,Analog3
jobs.modbus-heartbeat.fields.BOOL1=coil:1:BOOL
jobs.modbus-heartbeat.fields.BOOL2=coil:2:BOOL
jobs.modbus-heartbeat.fields.BOOL3=coil:3:BOOL
jobs.modbus-heartbeat.fields.Analog0=holding-register:40001:REAL
jobs.modbus-heartbeat.fields.Analog1=holding-register:40002:REAL
jobs.modbus-heartbeat.fields.Analog2=holding-register:40003:REAL
jobs.modbus-heartbeat.fields.Analog3=holding-register:40004:REAL


jobs.modbus-dashboard.interval=500
jobs.modbus-dashboard.fields=active
jobs.modbus-dashboard.fields.active=coil:1:BOOL


#-----Kafka Specific properties.
bootstrap.servers=127.0.0.1:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
#key.converter=io.confluent.connect.avro.AvroConverter
#value.converter=io.confluent.connect.avro.AvroConverter
#key.converter.schema.registry.url:http://127.0.0.1:8081
#value.converter.schema.registry.url:http://127.0.0.1:8081
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.storage.file.filename=/tmp/connect.offsets
offset.flush.interval.ms=10000
enable.idempotence=true
acks=all

In my PLC I have the following, Modbus TCP - AOI, enter image description here where I can se that the connector connects successfully. I have no idea where is the mistake.

1

There are 1 answers

0
Ben Hutcheson On

Taking a look at the config file, This line stands out

jobs.modbus-heartbeat.fields.Analog0=holding-register:40001:REAL

Double check that the Modbus address 40001 (4x40001) actually exists and you didn't mean holding-register:1:REAL.