OSGP / Documentation

This repository contains documentation for the Open Smart Grid Platform project. This repository is built as a GitBook, therefore all content has to be written using markdown syntax. See the latest GitBook:
https://documentation.gxf.lfenergy.org/
Apache License 2.0
24 stars 15 forks source link

Exception : PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; #213

Closed Sanu153 closed 4 years ago

Sanu153 commented 4 years ago

Hi,

I am currently building smart-metering application using SoapUI. I have already added the certificate file(test-org.pfx) into the project. Now I encounter only one type of exception while performing any operation. PKIX path building failed exception is thrown while performing any of the operations defined in all WSDL Files. But I could perform the AddDeviceRequest & AddDeviceAsyncRequest operation present in the SmartMeteringInstallation.wsdl

Kindly help me to resolve the issue. The screenshot and the generated logs are attached below..

Screenshot from 2019-09-23 19-02-42


2019-09-23 14:42:49.241] [sanu-pc] [ajp-nio-8009-exec-16] INFO o.o.a.w.e.WebServiceMonitorInterceptor@printSoapMessage:338 - soap message: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.opensmartgridplatform.org/schemas/common/2014/10" xmlns:ns1="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-adhoc/2014/10">
   <soapenv:Header>
      <ns:ApplicationName>AutomaticTest</ns:ApplicationName>
      <ns:UserName>SoapUI</ns:UserName>
      <ns:OrganisationIdentification>sanu-test1</ns:OrganisationIdentification>
   </soapenv:Header>
   <soapenv:Body>
      <ns1:GetAssociationLnObjectsRequest>
         <!--type: DeviceIdentification-->
         <ns1:DeviceIdentification>TEST1024000000ST1</ns1:DeviceIdentification>
      </ns1:GetAssociationLnObjectsRequest>
   </soapenv:Body>
</soapenv:Envelope>
2019-09-23 14:42:49.309] [sanu-pc] [ajp-nio-8009-exec-16] INFO o.o.d.core.services.SecurityService@checkAuthorization:106 - Organisation sanu-test1 is allowed GET_ASSOCIATION_LN_OBJECTS for device TEST1024000000ST1
2019-09-23 14:42:49.310] [sanu-pc] [ajp-nio-8009-exec-16] INFO o.o.a.w.s.i.j.SmartMeteringRequestMessageSender@sendMessage:77 - Sending message to the smart metering requests queue
2019-09-23 14:42:49.444] [sanu-pc] [ActiveMQ Task-1] INFO o.a.a.t.failover.FailoverTransport@doReconnect:1052 - Successfully connected to ssl://localhost:61617
2019-09-23 14:42:49.462] [sanu-pc] [domainSmartMeteringIncomingWebServiceRequestMessageListenerContainer-1] INFO o.o.a.d.s.i.j.w.WebServiceRequestMessageListener@onMessage:41 - Received message of type: GET_ASSOCIATION_LN_OBJECTS
2019-09-23 14:42:49.463] [sanu-pc] [domainSmartMeteringIncomingWebServiceRequestMessageListenerContainer-1] INFO o.o.a.d.s.i.j.BaseRequestMessageProcessor@processMessage:95 - Calling application service function: GET_ASSOCIATION_LN_OBJECTS
2019-09-23 14:42:49.520] [sanu-pc] [ajp-nio-8009-exec-16] INFO o.o.a.w.e.WebServiceMonitorInterceptor@printSoapMessage:338 - soap message: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns2:GetAssociationLnObjectsAsyncResponse xmlns:ns2="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-adhoc/2014/10" xmlns:ns3="http://www.opensmartgridplatform.org/schemas/common/2014/10" xmlns:ns4="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-configuration/2014/10"><ns3:DeviceIdentification>TEST1024000000ST1</ns3:DeviceIdentification><ns3:CorrelationUid>sanu-test1|||TEST1024000000ST1|||20190923144249310|||d94f72e9-573f-4ce4-91d9-ec6a5e01b9e5</ns3:CorrelationUid></ns2:GetAssociationLnObjectsAsyncResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2019-09-23 14:42:49.574] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.d.DomainRequestMessageListener@onMessage:49 - Received domain request message of type: GET_ASSOCIATION_LN_OBJECTS for domain: SMART_METERING and domainVersion: 1.0
2019-09-23 14:42:49.590] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.a.s.DeviceRequestMessageService@processMessage:64 - Device is using protocol [DSMR] with version [4.2.2]
2019-09-23 14:42:49.617] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.d.core.services.SecurityService@checkAuthorization:106 - Organisation sanu-test1 is allowed GET_ASSOCIATION_LN_OBJECTS for device TEST1024000000ST1
2019-09-23 14:42:49.617] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@send:56 - Sending protocol request message for device [TEST1024000000ST1] using protocol [DSMR] with version [4.2.2]
2019-09-23 14:42:49.617] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@send:61 - Message sender destination queue: [protocol-dlms.1_0.osgp-core.1_0.requests] for protocol [DSMR] with version [4.2.2]
2019-09-23 14:42:49.617] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@sendMessage:70 - Sending request message to protocol requests queue
2019-09-23 14:42:49.620] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] INFO o.o.a.p.d.i.m.DeviceRequestMessageListener@onMessage:36 - Received message of type: GET_ASSOCIATION_LN_OBJECTS
2019-09-23 14:42:49.657] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] TRACE o.s.ws.client.MessageTracing.sent@sendRequest:653 - Sent request [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" SOAP-ENV:mustUnderstand="1"><wsse:UsernameToken wsu:Id="UsernameToken-5294B3FAD9AD75756C156924976965537"><wsse:Username>TestUser</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">1234</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><ns2:GetSessionInfoRequest xmlns:ns2="http://api.jasperwireless.com/ws/schema"><ns2:messageId>messageID|||1234|||20190923144249646|||6d5dfd36-15ce-497b-be4b-fcf50edb9a98</ns2:messageId><ns2:version>0.01</ns2:version><ns2:licenseKey>00000000-0000-0000-0000-000000000000</ns2:licenseKey><ns2:iccid>1234</ns2:iccid></ns2:GetSessionInfoRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>]
2019-09-23 14:42:49.661] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.d.DomainRequestMessageListener@onMessage:60 - Domain request for device [TEST1024000000ST1] processed.
2019-09-23 14:42:49.714] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] ERROR o.o.a.p.d.i.m.DeviceRequestMessageProcessor@processMessage:116 - Unexpected exception during GET_ASSOCIATION_LN_OBJECTS
org.springframework.ws.client.WebServiceIOException: I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:561)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
    at org.opensmartgridplatform.adapter.protocol.jasper.infra.ws.JasperWirelessTerminalClient.getSession(JasperWirelessTerminalClient.java:57)
    at org.opensmartgridplatform.adapter.protocol.jasper.sessionproviders.SessionProviderKpn.getIpAddress(SessionProviderKpn.java:49)
    at org.opensmartgridplatform.adapter.protocol.dlms.application.services.DomainHelperService.getDeviceIpAddressFromSessionProvider(DomainHelperService.java:92)
    at org.opensmartgridplatform.adapter.protocol.dlms.application.services.DomainHelperService.findDlmsDevice(DomainHelperService.java:81)
    at org.opensmartgridplatform.adapter.protocol.dlms.application.services.DomainHelperService.findDlmsDevice(DomainHelperService.java:65)
    at org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageProcessor.processMessage(DeviceRequestMessageProcessor.java:94)
    at org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageListener.onMessage(DeviceRequestMessageListener.java:42)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:744)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:682)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1168)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1160)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1057)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)
    at org.springframework.ws.transport.http.HttpUrlConnection.getRequestOutputStream(HttpUrlConnection.java:89)
    at org.springframework.ws.transport.AbstractSenderConnection$RequestTransportOutputStream.createOutputStream(AbstractSenderConnection.java:87)
    at org.springframework.ws.transport.TransportOutputStream.getOutputStream(TransportOutputStream.java:41)
    at org.springframework.ws.transport.TransportOutputStream.write(TransportOutputStream.java:64)
    at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.writeTo(MessageImpl.java:1314)
    at org.springframework.ws.soap.saaj.SaajSoapMessage.writeTo(SaajSoapMessage.java:275)
    at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:46)
    at org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceTemplate.java:658)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:606)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
    ... 18 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
    at sun.security.validator.Validator.validate(Validator.java:262)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621)
    ... 40 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
    ... 46 common frames omitted
2019-09-23 14:42:49.759] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolResponseMessageListener@onMessage:35 - Received protocol response message with correlationUid [sanu-test1|||TEST1024000000ST1|||20190923144249310|||d94f72e9-573f-4ce4-91d9-ec6a5e01b9e5] and type [GET_ASSOCIATION_LN_OBJECTS]
2019-09-23 14:42:49.760] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.a.s.DeviceResponseMessageService@processMessage:57 - Processing protocol response message with correlation uid [sanu-test1|||TEST1024000000ST1|||20190923144249310|||d94f72e9-573f-4ce4-91d9-ec6a5e01b9e5]
2019-09-23 14:42:49.768] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.a.s.DeviceCommunicationInformationService@updateDeviceConnectionInformation:55 - Updated connection information for device: TEST1024000000ST1, last successful connection timestamp: 2019-09-23 13:25:49.587, last failed connection timestamp: Mon Sep 23 14:42:49 UTC 2019, connection failure count: 4 based on result type: NOT_OK
2019-09-23 14:42:49.789] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.a.s.DeviceResponseMessageService@processMessage:68 - Handling protocol response 
```message.
kevinsmeets commented 4 years ago

Hello Sanu153,

You should set the system up in a different way.

The default setup for us is to obtain an IP address for a meter by asking a telecom provider (KPN) for the IP address (via an API called JasperWireless). You are not going to be able to use this without credentials and SIM cards from KPN.

Try to configure the system using a static IP address: If you set ip_address_is_static to true in table dlms_device of database osgp_adapter_protocol_dlms, the system will use the IP address as configured in network_address in table device of database osgp_core.

image

As you can see, this error has nothing to do with OSGP's SOAP web service or the certificates

Sanu153 commented 4 years ago

Thank you for your swift response and action. Through I had configure the system using a static IP address as you had instructed to set ip_address_is_static to true in table dlms_device of database osgp_adapter_protocol_dlms and assigned an static IP that is 127.0.0.1 in network_address in table device of database osgp_core. Now I encounter the following exception while performing any operation.

ERROR o.o.a.p.d.i.m.DeviceRequestMessageProcessor@processMessage:116 - Unexpected exception during GET_ASSOCIATION_LN_OBJECTS org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException: java.net.ConnectException: Connection refused (Connection refused)

Kindly help me to resolve the issue. The screenshot and the generated logs are attached below. Screenshot from 2019-09-24 19-43-35

2019-09-24 14:13:26.636] [sanu-pc] [ajp-nio-8009-exec-34] INFO o.o.a.w.e.WebServiceMonitorInterceptor@printSoapMessage:338 - soap message: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.opensmartgridplatform.org/schemas/common/2014/10" xmlns:ns1="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-adhoc/2014/10">
   <soapenv:Header>
      <ns:ApplicationName>AutomaticTest</ns:ApplicationName>
      <ns:UserName>SoapUI</ns:UserName>
      <ns:OrganisationIdentification>sanu-test1</ns:OrganisationIdentification>
   </soapenv:Header>
   <soapenv:Body>
      <ns1:GetAssociationLnObjectsRequest>
         <!--type: DeviceIdentification-->
         <ns1:DeviceIdentification>TEST1024000000ST1</ns1:DeviceIdentification>
      </ns1:GetAssociationLnObjectsRequest>
   </soapenv:Body>
</soapenv:Envelope>
2019-09-24 14:13:26.701] [sanu-pc] [ajp-nio-8009-exec-34] INFO o.o.d.core.services.SecurityService@checkAuthorization:106 - Organisation sanu-test1 is allowed GET_ASSOCIATION_LN_OBJECTS for device TEST1024000000ST1
2019-09-24 14:13:26.702] [sanu-pc] [ajp-nio-8009-exec-34] INFO o.o.a.w.s.i.j.SmartMeteringRequestMessageSender@sendMessage:77 - Sending message to the smart metering requests queue
2019-09-24 14:13:26.808] [sanu-pc] [ActiveMQ Task-1] INFO o.a.a.t.failover.FailoverTransport@doReconnect:1052 - Successfully connected to ssl://localhost:61617
2019-09-24 14:13:26.840] [sanu-pc] [domainSmartMeteringIncomingWebServiceRequestMessageListenerContainer-2] INFO o.o.a.d.s.i.j.w.WebServiceRequestMessageListener@onMessage:41 - Received message of type: GET_ASSOCIATION_LN_OBJECTS
2019-09-24 14:13:26.841] [sanu-pc] [domainSmartMeteringIncomingWebServiceRequestMessageListenerContainer-2] INFO o.o.a.d.s.i.j.BaseRequestMessageProcessor@processMessage:95 - Calling application service function: GET_ASSOCIATION_LN_OBJECTS
2019-09-24 14:13:26.870] [sanu-pc] [ajp-nio-8009-exec-34] INFO o.o.a.w.e.WebServiceMonitorInterceptor@printSoapMessage:338 - soap message: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns3:GetAssociationLnObjectsAsyncResponse xmlns:ns2="http://www.opensmartgridplatform.org/schemas/common/2014/10" xmlns:ns3="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-adhoc/2014/10" xmlns:ns4="http://www.opensmartgridplatform.org/schemas/smartmetering/sm-configuration/2014/10"><ns2:DeviceIdentification>TEST1024000000ST1</ns2:DeviceIdentification><ns2:CorrelationUid>sanu-test1|||TEST1024000000ST1|||20190924141326702|||957889fb-60f3-42aa-b603-253a355f5d25</ns2:CorrelationUid></ns3:GetAssociationLnObjectsAsyncResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2019-09-24 14:13:26.951] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.d.DomainRequestMessageListener@onMessage:49 - Received domain request message of type: GET_ASSOCIATION_LN_OBJECTS for domain: SMART_METERING and domainVersion: 1.0
2019-09-24 14:13:26.963] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.a.s.DeviceRequestMessageService@processMessage:64 - Device is using protocol [DSMR] with version [4.2.2]
2019-09-24 14:13:26.993] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.d.core.services.SecurityService@checkAuthorization:106 - Organisation sanu-test1 is allowed GET_ASSOCIATION_LN_OBJECTS for device TEST1024000000ST1
2019-09-24 14:13:26.994] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@send:56 - Sending protocol request message for device [TEST1024000000ST1] using protocol [DSMR] with version [4.2.2]
2019-09-24 14:13:26.994] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@send:61 - Message sender destination queue: [protocol-dlms.1_0.osgp-core.1_0.requests] for protocol [DSMR] with version [4.2.2]
2019-09-24 14:13:26.994] [sanu-pc] [DefaultMessageListenerContainer-1] INFO o.o.c.i.j.p.ProtocolRequestMessageSender@sendMessage:70 - Sending request message to protocol requests queue
2019-09-24 14:13:26.997] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] INFO o.o.a.p.d.i.m.DeviceRequestMessageListener@onMessage:36 - Received message of type: GET_ASSOCIATION_LN_OBJECTS
2019-09-24 14:13:27.007] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] INFO o.o.a.p.d.i.m.DeviceRequestMessageProcessor@processMessage:97 - GET_ASSOCIATION_LN_OBJECTS called for device: TEST1024000000ST1 for organisation: sanu-test1
2019-09-24 14:13:27.009] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] INFO o.o.a.p.d.a.s.SecurityKeyService@getDlmsPassword:283 - Retrieving DLMS LLS Password for device TEST1024000000ST1
2019-09-24 14:13:27.012] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] WARN o.o.a.p.d.a.s.SecurityKeyService@getKey:298 - No valid PASSWORD key found with device TEST1024000000ST1 - returning null.
2019-09-24 14:13:27.014] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] ERROR o.o.a.p.d.i.m.DeviceRequestMessageProcessor@processMessage:116 - Unexpected exception during GET_ASSOCIATION_LN_OBJECTS
org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException: java.net.ConnectException: Connection refused (Connection refused)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.Lls1Connector.connect(Lls1Connector.java:60)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionManager.connect(DlmsConnectionManager.java:118)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionFactory.newConnectionWithSecurityLevel(DlmsConnectionFactory.java:99)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionFactory.getConnection(DlmsConnectionFactory.java:67)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionHelper.createConnectionForDevice(DlmsConnectionHelper.java:49)
    at org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DlmsConnectionMessageProcessor.createConnectionForDevice(DlmsConnectionMessageProcessor.java:59)
    at org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageProcessor.processMessage(DeviceRequestMessageProcessor.java:102)
    at org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageListener.onMessage(DeviceRequestMessageListener.java:42)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:744)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:682)
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317)
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1168)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1160)
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1057)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:244)
    at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277)
    at org.openmuc.jdlms.transportlayer.client.TcpLayer.open(TcpLayer.java:76)
    at org.openmuc.jdlms.sessionlayer.client.WrapperLayer.startListening(WrapperLayer.java:66)
    at org.openmuc.jdlms.BaseDlmsConnection.connect(BaseDlmsConnection.java:179)
    at org.openmuc.jdlms.DlmsLnConnectionWrapper.connect(DlmsLnConnectionWrapper.java:35)
    at org.openmuc.jdlms.ConnectionBuilder.build(ConnectionBuilder.java:365)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.SecureDlmsConnector.createConnection(SecureDlmsConnector.java:86)
    at org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.Lls1Connector.connect(Lls1Connector.java:53)
    ... 16 common frames omitted
2019-09-24 14:13:27.015] [sanu-pc] [dlmsRequestsMessageListenerContainer-2] INFO o.o.a.p.d.i.m.RetryHeaderFactory@createRetryHeader:40 - Creating retry header for retryCount: 0, maximumRetries: 2, scheduledRetryTime: Tue Sep 24 14:13:57 UTC 2019.
kevinsmeets commented 4 years ago

Well, it seems you are now opening a connection to your meter. The meter refuses the connection.

I'm not able to tell you what to do next. This depends on:

Update: I missed the part where you are using 127.0.0.1 as the IP address. What are you connecting to at localhost?

Sanu153 commented 4 years ago

Sir, I am trying to make a demo-smart-metering app. Is it possible to make an application like web-demo-app(i;e public-lighting) without using the real meter in my demo-smart-metering app for testing purpose. On later stage after succesfully configuring the demo-smart-metering app i will try it with real smart meter for further activity. Would you do me a favor for the above scenario?

kevinsmeets commented 4 years ago

I think it is possible to create a demo application for smart meter OSGP functionality. We don't have a smart meter simulator application available as an open-source component.

A solution could be to use the OpenMUC project. We are using the DLMS client library in the osgp-protocol-adapter-dlms component. The DLMS server library could be used to simulate a smart meter:

https://www.openmuc.org/dlms-cosem/ https://www.openmuc.org/dlms-cosem/user-guide/#_server

Sanu153 commented 4 years ago

Sir, Thanks for the support. I am studing the OpenMUC Project as suggested, but for quick implementation can you please provide step by step procedure to implement the smart-meterng application.

kevinsmeets commented 4 years ago

I'm not sure how to help you with a step by step procedure. The web-demo-app has been built using Spring MVC, JSP, and JQuery. That is a pretty old way of building a web application and there are lots of examples on the internet.

The way communication with OSGP works can be derived from the classes in the package org.opensmartgridplatform.webdemoapp.infra.platform and the application configuration of the web-demo-app.

Sanu153 commented 4 years ago

Thank you for your support and time.

I'm closing this issue and will be raising another in case I encounter any.

Thank you.