ibes13 commented on issue #1257:
URL: https://github.com/apache/plc4x/issues/1257#issuecomment-1943367289
Hi,
I have tested connecting and reading with the current snapshot version again.
Reading values now works without an error :blush:
There is still an error when establishing the connection. Also the function
"isConnected()" of the interface "PlcConnection" sometimes returns true and
sometimes false. However, this does not affect the reading process.
```
2024-02-14 09:26:16,461 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.onConnect(S7ProtocolLogic.java:156)]
(executor-thread-2) Sending COTP Connection Request
2024-02-14 09:26:16,466 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: Multiplexor
2024-02-14 09:26:16,470 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: LoggingHandler#0
2024-02-14 09:26:16,474 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: DefaultNettyPlcConnection$1$1#0
2024-02-14 09:26:16,478 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: DefaultNettyPlcConnection$1$2#0
2024-02-14 09:26:16,482 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: CODEC
2024-02-14 09:26:16,485 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: EventListenerMessageCodec#0
2024-02-14 09:26:16,489 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: WRAPPER
2024-02-14 09:26:16,493 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$0(S7ProtocolLogic.java:162)]
(executor-thread-2) Nombre tuberias: DefaultChannelPipeline$TailContext#0
2024-02-14 09:26:16,497 DEBUG [org.apa.plc.jav.s7.rea.pro.S7HMuxImpl
org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.encode(S7HMuxImpl.java:130)]
(executor-thread-2) ENCODE: PooledUnsafeDirectByteBuf(ridx: 0, widx: 22, cap:
256)
2024-02-14 09:26:16,501 DEBUG [org.apa.plc.jav.s7.rea.pro.S7HMuxImpl
org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.encode(S7HMuxImpl.java:130)]
(nioEventLoopGroup-4-1) ENCODE: PooledUnsafeDirectByteBuf(ridx: 0, widx: 22,
cap: 22)
2024-02-14 09:26:16,501 INFO [org.apa.plc.jav.s7.rea.pro.S7HMuxImpl
org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.userEventTriggered(S7HMuxImpl.java:178)]
(executor-thread-2) 09:26:16.501457600 userEventTriggered: Multiplexor Event:
org.apache.plc4x.java.spi.events.ConnectEvent@19d4f050
2024-02-14 09:26:16,508 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$3(S7ProtocolLogic.java:176)]
(nioEventLoopGroup-4-1) Got COTP Connection Response
2024-02-14 09:26:16,513 DEBUG [org.apa.plc.jav.s7.rea.pro.S7ProtocolLogic
org.apache.plc4x.java.s7.readwrite.protocol.S7ProtocolLogic.lambda$3(S7ProtocolLogic.java:177)]
(nioEventLoopGroup-4-1) Sending S7 Connection Request
2024-02-14 09:26:16,517 DEBUG [org.apa.plc.jav.s7.rea.pro.S7HMuxImpl
org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.encode(S7HMuxImpl.java:130)]
(nioEventLoopGroup-4-1) ENCODE: PooledUnsafeDirectByteBuf(ridx: 0, widx: 25,
cap: 256)
2024-02-14 09:26:16,522 DEBUG [org.apa.plc.jav.s7.rea.pro.S7HMuxImpl
org.apache.plc4x.java.s7.readwrite.protocol.S7HMuxImpl.encode(S7HMuxImpl.java:130)]
(nioEventLoopGroup-4-1) ENCODE: PooledUnsafeDirectByteBuf(ridx: 0, widx: 25,
cap: 25)
2024-02-14 09:26:16,526 WARN [io.net.cha.emb.EmbeddedChannel
io.netty.channel.embedded.EmbeddedChannel.recordException(EmbeddedChannel.java:645)]
(nioEventLoopGroup-4-1) More than one exception was raised. Will report only
the first one and log others.: 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:146)
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:833)
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:879)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
at
io.netty.handler.logging.LoggingHandler.write(LoggingHandler.java:288)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
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:879)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
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:879)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
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:879)
at
io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940)
at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:966)
at
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:934)
at
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:984)
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$3(S7ProtocolLogic.java:190)
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)
Caused by: io.netty.handler.codec.EncoderException: MessageToMessageCodec$1
must produce at least one message.
... 40 more
```
Here is the test code for establishing the connection to the PLC
```
public boolean connect(String serverUri, String rack, String slot) {
try{
connection = new
DefaultPlcDriverManager().getConnection("s7://"+serverUri+"?remote-rack="+rack+"&remote-slot="+slot+"&controller-type=S7_1500");
Log.info("connected - "+connection.isConnected());
}catch(Exception ex){
ex.printStackTrace();
Log.error("not connected",ex);
}
Log.info("s7 client connected ? - "+connection.isConnected());
return connection.isConnected();
}
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]