Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

spring boot - OpcUA connection failed

I'm sorry for the question, but I'm new to Milo and I'm trying to use the apache - camel - milo version, in a SpringBoot application. I try to read a data but I can't connect with the application but only with UaExpert. To make it easier I have the server configured to accept connections with a security policy of none. I enclose error and configuration. Can you give me some advice?

<springboot.version>2.4.2</spring.version>
<camel-milo.version>2.25.3</camel.version>
Application.properties
  • camel.component.milo-client.allowed-security-policies=None
  • camel.component.milo-client.autowired-enabled=true
  • camel.component.milo-client.channel-lifetime=3600000
  • camel.component.milo-client.enabled=true
  • camel.component.milo-client.lazy-start-producer=true
  • camel.component.milo-client.max-response-message-size=102400
  • camel.component.milo-client.request-timeout=120000
  • camel.component.milo-client.session-timeout=1200000
Configured route
from("milo-client:opc.tcp://7.182.83.5:4840?samplingInterval=2000&node=RAW(ns=4;s=GV_PcHmi.tPcHmi.tPlcToPcHmiSta.uiSpindleOverride)")
                .routeId("Test router id1")
                .log("From OPC UA: ${body}")
                .process((Exchange exchange) -> {                    
                    String routeId = exchange.getFromRouteId();
                    DataValue data = exchange.getIn().getBody(DataValue.class);
                    
                    System.out.println("Route  : " + routeId);
                    System.out.println("Status : " + data.getStatusCode().toString());
                    System.out.println("Type   : " + data.getValue().getDataType().getClass());
                    System.out.println("Value  : " + data.getValue().getValue());                    
                });
ERROR
Configuring route for endpoint: {}
2021-gen-27 14:37:49.964 DEBUG [restartedMain] o.e.m.o.s.c.ClientChannelManager - connect(), currentState=NotConnected
 2021-gen-27 14:37:49.977 DEBUG [restartedMain] o.e.m.o.s.c.ClientChannelManager - connect() while NotConnected
 java.lang.Exception: null
    at org.eclipse.milo.opcua.stack.client.ClientChannelManager.connect(ClientChannelManager.java:67)
    at org.eclipse.milo.opcua.stack.client.UaTcpStackClient.connect(UaTcpStackClient.java:127)
    at org.eclipse.milo.opcua.stack.client.UaTcpStackClient.getEndpoints(UaTcpStackClient.java:577)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.performConnect(SubscriptionManager.java:434)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.performAndEvalConnect(SubscriptionManager.java:394)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.connect(SubscriptionManager.java:389)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.<init>(SubscriptionManager.java:359)
    at org.apache.camel.component.milo.client.MiloClientConnection.init(MiloClientConnection.java:49)
    at org.apache.camel.component.milo.client.MiloClientConnection.checkInit(MiloClientConnection.java:66)
    at org.apache.camel.component.milo.client.MiloClientConnection.monitorValue(MiloClientConnection.java:83)
    at org.apache.camel.component.milo.client.MiloClientConsumer.doStart(MiloClientConsumer.java:59)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72)
    at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3710)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:4028)
    at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3963)
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3883)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3647)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3488)
    at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3247)
    at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3243)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3266)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3243)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3159)
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
    at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:426)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:943)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
    at com.someco.hmi.SomecoHmiApplication.main(SomecoHmiApplication.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
2021-gen-27 14:37:50.548 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.h.UaTcpClientAcknowledgeHandler - Sent Hello message on channel=[id: 0x45a2280f, L:/7.78.241.111:49284 - R:/7.182.83.5:4840].
 2021-gen-27 14:37:50.656 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.h.UaTcpClientAcknowledgeHandler - Received Acknowledge message on channel=[id: 0x45a2280f, L:/7.78.241.111:49284 - R:/7.182.83.5:4840].
 2021-gen-27 14:37:50.673 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - OpenSecureChannel timeout scheduled for +5s
 2021-gen-27 14:37:50.971 DEBUG [ua-shared-pool-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - Sent OpenSecureChannelRequest (Issue, id=0, currentToken=-1, previousToken=-1).
 2021-gen-27 14:37:51.066 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - OpenSecureChannel timeout canceled
 2021-gen-27 14:37:51.095 DEBUG [ua-shared-pool-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - Received OpenSecureChannelResponse.
 2021-gen-27 14:37:51.098 DEBUG [ua-shared-pool-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - SecureChannel id=2265393235, currentTokenId=1, previousTokenId=-1, lifetime=3600000ms, createdAt=DateTime{utcTime=132562299229213770, javaDate=Wed Jan 27 15:05:22 CET 2021}
 2021-gen-27 14:37:51.100 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.h.UaTcpClientMessageHandler - 0 message(s) queued before handshake completed; sending now.
 2021-gen-27 14:37:51.101 DEBUG [ua-shared-pool-1] o.e.m.o.s.c.ClientChannelManager - Channel bootstrap succeeded: localAddress=/7.78.241.111:49284, remoteAddress=/7.182.83.5:4840
 2021-gen-27 14:37:51.320 DEBUG [ua-shared-pool-0] o.e.m.o.s.c.ClientChannelManager - disconnect(), currentState=Connected
 2021-gen-27 14:37:51.323 DEBUG [ua-shared-pool-1] o.e.m.o.s.c.ClientChannelManager - Sending CloseSecureChannelRequest...
 2021-gen-27 14:37:51.329 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.ClientChannelManager - channelInactive(), disconnect complete
 2021-gen-27 14:37:51.330 DEBUG [ua-netty-event-loop-0] o.e.m.o.s.c.ClientChannelManager - disconnect complete, state set to Idle
 2021-gen-27 14:37:51.343 INFO  [restartedMain] o.e.m.o.s.c.OpcUaClient - Eclipse Milo OPC UA Stack version: 0.2.4
 2021-gen-27 14:37:51.344 INFO  [restartedMain] o.e.m.o.s.c.OpcUaClient - Eclipse Milo OPC UA Client SDK version: 0.2.4
 2021-gen-27 14:37:51.405 DEBUG [restartedMain] o.e.m.o.s.c.OpcUaClient - Added ServiceFaultListener: org.eclipse.milo.opcua.sdk.client.session.SessionFsm$FaultListener@2200ac68
 2021-gen-27 14:37:51.426 DEBUG [restartedMain] o.e.m.o.s.c.OpcUaClient - Added SessionActivityListener: org.eclipse.milo.opcua.sdk.client.subscriptions.OpcUaSubscriptionManager$1@4e603cf9
 2021-gen-27 14:37:51.692 DEBUG [restartedMain] o.e.m.o.s.c.ClientChannelManager - connect(), currentState=NotConnected
 2021-gen-27 14:37:51.694 DEBUG [restartedMain] o.e.m.o.s.c.ClientChannelManager - connect() while NotConnected
 java.lang.Exception: null
    at org.eclipse.milo.opcua.stack.client.ClientChannelManager.connect(ClientChannelManager.java:67)
    at org.eclipse.milo.opcua.stack.client.UaTcpStackClient.connect(UaTcpStackClient.java:127)
    at org.eclipse.milo.opcua.sdk.client.OpcUaClient.connect(OpcUaClient.java:312)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.performConnect(SubscriptionManager.java:475)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.performAndEvalConnect(SubscriptionManager.java:394)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.connect(SubscriptionManager.java:389)
    at org.apache.camel.component.milo.client.internal.SubscriptionManager.<init>(SubscriptionManager.java:359)
    at org.apache.camel.component.milo.client.MiloClientConnection.init(MiloClientConnection.java:49)
    at org.apache.camel.component.milo.client.MiloClientConnection.checkInit(MiloClientConnection.java:66)
    at org.apache.camel.component.milo.client.MiloClientConnection.monitorValue(MiloClientConnection.java:83)
    at org.apache.camel.component.milo.client.MiloClientConsumer.doStart(MiloClientConsumer.java:59)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72)
    at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3710)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:4028)
    at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3963)
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3883)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3647)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3488)
    at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:32

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...