Closed xp7777 closed 7 months ago
When running your example, I only get issues with the last line:
After changing:
System.out.println( response.getTagNames()+"---"+response.getResponseCode(response.getTagNames().toString()));
To:
for (String tagName : response.getTagNames()) {
System.out.println( tagName+"---"+response.getResponseCode(tagName));
}
All worked fine on my machine ... what type of device are you connecting to?
thank you sir! "I'm using TIA v16 to simulate PLC operation on my computer."
issue is resolved. It indeed seems to have been caused by the problem with the for loop iteration."
------------------ 原始邮件 ------------------ 发件人: "apache/plc4x" @.>; 发送时间: 2024年3月18日(星期一) 下午5:21 @.>; @.**@.>; 主题: Re: [apache/plc4x] [Bug]: PlcInvalidTagException: [value1] invalid (Issue #1452)
When running your example, I only get issues with the last line:
After changing:
System.out.println( response.getTagNames()+"---"+response.getResponseCode(response.getTagNames().toString()));
To:
for (String tagName : response.getTagNames()) { System.out.println( tagName+"---"+response.getResponseCode(tagName)); }
All worked fine on my machine ... what type of device are you connecting to?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I think the TIA Simulator only has Network support in it's "Advanced" version. Are you using that?
Happy to help ... would you mind explain a bit what you are working on?
i have the same problem on version 0.12.0,but it is normal in version 0.11.0.
我认为 TIA 仿真器仅在其“高级”版本中具有网络支持。你在用那个吗?
I am using Nettoplcsim S7o software, which allows me to connect to TIA PLCSIM. I am developing an application using JavaFX that can read PLC data and store it in a database.
This is a different issue as the one reported here, right? Would you mind opening a new issue (Ideally attaching a wireshark recording of your S7 traffic?
What happened?
Hello Sir,
I hope this email finds you well. I am writing to seek assistance regarding an issue I encountered while using PLC4X version 0.12.0. Following the examples provided on the official website, I attempted to read the address %I0.2:BOOL. However, I encountered an error. Could you please advise on the possible reasons for this error?
Here is the code: package com.yxp;
import org.apache.plc4x.java.api.PlcConnection; import org.apache.plc4x.java.api.PlcDriverManager; import org.apache.plc4x.java.api.messages.PlcReadRequest; import org.apache.plc4x.java.api.messages.PlcReadResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
public class plc {
// - Give the single item requested an alias name PlcReadRequest.Builder builder = plcConnection.readRequestBuilder();
}
Error message as follows: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: MessageToMessageCodec$1 must produce at least one message. at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.decode(S7HMuxImpl.java:145) at org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.decode(S7HMuxImpl.java:1) at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: io.netty.handler.codec.EncoderException: MessageToMessageCodec$1 must produce at least one message. at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:99) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) at io.netty.handler.logging.LoggingHandler.write(LoggingHandler.java:288) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) at io.netty.handler.codec.ByteToMessageCodec.write(ByteToMessageCodec.java:108) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:875) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:984) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:868) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:891) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:956) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:982) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:950) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:1000) at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) at org.apache.plc4x.java.spi.internal.DefaultConversationContext.sendToWire(DefaultConversationContext.java:70) at org.apache.plc4x.java.spi.internal.DefaultSendRequestContext.handle(DefaultSendRequestContext.java:107) at org.apache.plc4x.java.spi.internal.DefaultSendRequestContext.handle(DefaultSendRequestContext.java:1) at org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$8(S7ProtocolLogic.java:231) at java.base/java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) at org.apache.plc4x.java.spi.Plc4xNettyWrapper.decode(Plc4xNettyWrapper.java:183) at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ... 40 more
org.apache.plc4x.java.api.exceptions.PlcInvalidTagException: [value1] invalid at org.apache.plc4x.java.spi.messages.DefaultPlcReadResponse.getResponseCode(DefaultPlcReadResponse.java:100) at com.yxp.plc.read(plc.java:39) at com.yxp.plc.main(plc.java:49)
Looking forward to your guidance and support.
Could you please advise on the possible reasons for this error and provide guidance on how to resolve it?
Thank you for your assistance.
Best regards
Version
0.12.0
Programming Languages
Protocols