plc4x-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Vogler <andreas.vog...@me.com.INVALID>
Subject Re: OPC UA Subscribe throws casting error ...
Date Fri, 05 Mar 2021 12:32:19 GMT
Thx, it works now.

BUT: I only get values every one second…

13:21:54.177 [milo-shared-thread-pool-0] INFO  o.a.p.j.e.h.s.HelloPlc4xSubscription - Field
'value-0' value: {"value":2.0,"isNullable":false}
13:21:55.178 [milo-shared-thread-pool-0] INFO  o.a.p.j.e.h.s.HelloPlc4xSubscription - Field
'value-0' value: {"value":7.0,"isNullable":false}
13:21:56.178 [milo-shared-thread-pool-0] INFO  o.a.p.j.e.h.s.HelloPlc4xSubscription - Field
'value-0' value: {"value":12.0,"isNullable":false}
13:21:57.179 [milo-shared-thread-pool-0] INFO  o.a.p.j.e.h.s.HelloPlc4xSubscription - Field
'value-0' value: {"value":17.0,"isNullable":false}
13:21:58.179 [milo-shared-thread-pool-1] INFO  o.a.p.j.e.h.s.HelloPlc4xSubscription - Field
'value-0' value: {"value":22.0,"isNullable":false}

The tag increases one by one every 200ms, and here in PLC4X we miss value changes..

Is there a way to adjust the opc ua subscription sampling interval and/or monitoring options
with PLC4X?

Regards,
Andreas



> On 05.03.2021, at 12:42, Ben Hutcheson <ben.hutche@gmail.com> wrote:
> 
> Hi Andreas,
> 
> That looks like an issue specific to your setup. It seems it's not finding
> some of the other modules that the opcua driver and the example rely on.
> Can you build the entire project 'mvn clean && mvn install'?
> 
> If you could send through some more info, maven logs, etc.. it would be
> helpful.
> 
> Kind Regards
> 
> Ben
> 
> 
> On Fri, Mar 5, 2021 at 6:27 AM Andreas Vogler <andreas.vogler@me.com.invalid>
> wrote:
> 
>> Hi Ben,
>> 
>> with this Branch I get a build error - just opened it in Intellij and
>> tried to run the subscribe example...
>> 
>> /Users/vogler/Workspace/Private/plc4x/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/configuration/AdsConfiguration.java:23:43
>> java: package org.apache.plc4x.java.ads.readwrite does not exist
>> 
>> I see in e.g. OpcuaField.java: Cannot resolve symbol 'OpcuaIdentifierType'
>> 
>> Regards,
>> Andreas
>> 
>>> On 05.03.2021, at 11:05, Ben Hutcheson <ben.hutche@gmail.com> wrote:
>>> 
>>> 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
>> <andreas.vogler@me.com.invalid>
>>> 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 <
>>>> matthias.strljic@gmail.com> 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 <christofer.dutz@c-ware.de>
>>>>>> *Gesendet:* Mittwoch, 3. März 2021 20:40
>>>>>> *An:* dev@plc4x.apache.org
>>>>>> *Betreff:* AW: OPC UA Subscribe throws casting error ...
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> perhaps Matthias can help you with this one?
>>>>>> 
>>>>>> Chris
>>>>>> 
>>>>>> 
>>>>>> -----Ursprüngliche Nachricht-----
>>>>>> Von: Andreas Vogler <andreas.vogler@me.com.INVALID>
>>>>>> Gesendet: Mittwoch, 3. März 2021 20:22
>>>>>> An: dev@plc4x.apache.org
>>>>>> 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
>> <andreas.vogler@me.com.INVALID
>>>>> 
>>>>>> 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)
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 


Mime
View raw message