Hi Andreas, I also saw the same issue running the example. I have just pushed a branch to fix this bug/opcua_subscription. If you can try it out that would be great.
Kind Regards Ben On Wed, Mar 3, 2021 at 3:12 PM Andreas Vogler <[email protected]> wrote: > Hi Matthias, > > It’s > * Java 11.0.9 (Amazon Corretto) > * Intellij 2020.3.2 > * git clone https://github.com/apache/plc4x.git < > https://github.com/apache/plc4x.git> > > The attached stack trace was from my project - Kotlin - maybe “app” comes > from there. > But you can just use the subscription example from the plc4x.git, it > throws the same error. > > Regards, > Andreas > > > > > On 03.03.2021, at 21:04, Matthias Milan Strljic < > [email protected]> wrote: > > > > Hi Andreas, > > > > can you give us a bit more information about your scenario and setup? > > Project config, java version, java jvm, IDE environment, PLC4X version / > > Github branch? > > Because the " are in unnamed module of loader 'app'" confuses me a bit. > > > > Greetings Matthias > > > > ------------------------------ > >> *Von:* Christofer Dutz <[email protected]> > >> *Gesendet:* Mittwoch, 3. März 2021 20:40 > >> *An:* [email protected] > >> *Betreff:* AW: OPC UA Subscribe throws casting error ... > >> > >> Hi, > >> > >> perhaps Matthias can help you with this one? > >> > >> Chris > >> > >> > >> -----Ursprüngliche Nachricht----- > >> Von: Andreas Vogler <[email protected]> > >> Gesendet: Mittwoch, 3. März 2021 20:22 > >> An: [email protected] > >> Betreff: Re: OPC UA Subscribe throws casting error ... > >> > >> Same happens with the plc4j hello-world-plc4x-subscription example from > >> the GitHub repository. > >> > >>> On 03.03.2021, at 18:00, Andreas Vogler <[email protected] > > > >> wrote: > >>> > >>> 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(ForkJoinWorker > >>> Thread.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(ForkJoinWorker > >>> Thread.java:183) > >>> > >>> > >>> > >> > >> > >
