Hi,
I have tried to subscribe to an OPC UA node - just took the few lines from the
subscription example - and I get following stack trace.
I hope someone can tell me what I am doing wrong… :-)
val builder: PlcSubscriptionRequest.Builder = plc!!.subscriptionRequestBuilder()
topics.forEach {
builder.addChangeOfStateField(it.payload, it.payload)
}
val request = builder.build()
val response = request.execute()
val subscribeResponse = response.get() ==> the exception is thrown here
[2021-03-03 17:52:26][INFO ][opc ] Subscribe nodes
[1]
java.util.concurrent.ExecutionException: java.lang.ClassCastException: class
org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField cannot be cast to
class org.apache.plc4x.java.opcua.protocol.OpcuaField
(org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField and
org.apache.plc4x.java.opcua.protocol.OpcuaField are in unnamed module of loader
'app')
at
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at Plc4xVerticle.subscribeNodes(Plc4xVerticle.kt:84)
at Plc4xVerticle.subscribeTopics(Plc4xVerticle.kt:66)
at
at.rocworks.gateway.core.driver.DriverBase.subscribeTopic(DriverBase.kt:170)
at
at.rocworks.gateway.core.driver.DriverBase.subscribeHandler(DriverBase.kt:127)
at
at.rocworks.gateway.core.driver.DriverBase.access$subscribeHandler(DriverBase.kt:24)
at
at.rocworks.gateway.core.driver.DriverBase$connectHandlers$2.handle(DriverBase.kt:105)
at
at.rocworks.gateway.core.driver.DriverBase$connectHandlers$2.handle(DriverBase.kt:24)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:52)
at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:194)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.dispatch(MessageConsumerImpl.java:177)
at
io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.next(HandlerRegistration.java:163)
at
io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.dispatch(HandlerRegistration.java:128)
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:107)
at
io.vertx.core.eventbus.impl.HandlerRegistration.dispatch(HandlerRegistration.java:104)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.deliver(MessageConsumerImpl.java:183)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.doReceive(MessageConsumerImpl.java:168)
at
io.vertx.core.eventbus.impl.HandlerRegistration.lambda$receive$0(HandlerRegistration.java:54)
at
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
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:829)
Caused by: java.lang.ClassCastException: class
org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField cannot be cast to
class org.apache.plc4x.java.opcua.protocol.OpcuaField
(org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField and
org.apache.plc4x.java.opcua.protocol.OpcuaField are in unnamed module of loader
'app')
at
org.apache.plc4x.java.opcua.connection.OpcuaTcpPlcConnection.lambda$subscribe$3(OpcuaTcpPlcConnection.java:388)
at
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
java.util.concurrent.ExecutionException: java.lang.ClassCastException: class
org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField cannot be cast to
class org.apache.plc4x.java.opcua.protocol.OpcuaField
(org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField and
org.apache.plc4x.java.opcua.protocol.OpcuaField are in unnamed module of loader
'app')
at
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at Plc4xVerticle.subscribeNodes(Plc4xVerticle.kt:84)
at Plc4xVerticle.subscribeTopics(Plc4xVerticle.kt:66)
at
at.rocworks.gateway.core.driver.DriverBase.subscribeTopic(DriverBase.kt:170)
at
at.rocworks.gateway.core.driver.DriverBase.subscribeHandler(DriverBase.kt:127)
at
at.rocworks.gateway.core.driver.DriverBase.access$subscribeHandler(DriverBase.kt:24)
at
at.rocworks.gateway.core.driver.DriverBase$connectHandlers$2.handle(DriverBase.kt:105)
at
at.rocworks.gateway.core.driver.DriverBase$connectHandlers$2.handle(DriverBase.kt:24)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:52)
at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:194)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.dispatch(MessageConsumerImpl.java:177)
at
io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.next(HandlerRegistration.java:163)
at
io.vertx.core.eventbus.impl.HandlerRegistration$InboundDeliveryContext.dispatch(HandlerRegistration.java:128)
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:107)
at
io.vertx.core.eventbus.impl.HandlerRegistration.dispatch(HandlerRegistration.java:104)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.deliver(MessageConsumerImpl.java:183)
at
io.vertx.core.eventbus.impl.MessageConsumerImpl.doReceive(MessageConsumerImpl.java:168)
at
io.vertx.core.eventbus.impl.HandlerRegistration.lambda$receive$0(HandlerRegistration.java:54)
at
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
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:829)
Caused by: java.lang.ClassCastException: class
org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField cannot be cast to
class org.apache.plc4x.java.opcua.protocol.OpcuaField
(org.apache.plc4x.java.spi.model.DefaultPlcSubscriptionField and
org.apache.plc4x.java.opcua.protocol.OpcuaField are in unnamed module of loader
'app')
at
org.apache.plc4x.java.opcua.connection.OpcuaTcpPlcConnection.lambda$subscribe$3(OpcuaTcpPlcConnection.java:388)
at
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)