[RaspberryPi Tutorial] Unable to connect LSR to EMS
- December 20, 2016
- 19 replies
- 9919 views
Hi everybody,
I'm currently working my way into the ThingWorx ecosystem and I am currently stuck on the Raspberry Pi Quickstart Guide when trying to connect the Lua Script Ressource to the running Edge Micro Server (Step 10).
I am connecting to a ThingWorx Foundation Server from the Developer Portal which works just fine. But when I try to start the LSR I get connection errors. Guessing from the log entries the LSR works find but fails when trying to connect to the local EMS.
To not bloat this discussion I have attached a full trace log of WSEMS as well as LSR. Below you can find extracts of both logs which I found most useful for the problem at hand.
The most prominent lines from the WSEMS log are the following:
[TRACE] 2016-12-20 14:22:05,301 SDK: twWs_Receive: Received Pong
[TRACE] 2016-12-20 14:22:05,301 SDK: msgHandlerOnPong: Received Pong. Data: 13:22:05
[DEBUG] 2016-12-20 14:22:35,525 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2016-12-20 14:22:35,525 TlsStream:: doopen: Setting SO_RCVTIMEO
[TRACE] 2016-12-20 14:22:35,525 TlsStream:: doopen: Non-SSL server socket opened
[TRACE] 2016-12-20 14:22:35,525 httpServer: Allocating new client: 1
[TRACE] 2016-12-20 14:22:35,525 client_thread::execute: Starting request handler thread 2
[DEBUG] 2016-12-20 14:22:35,525 RestThingworx::callback: Handling request
[DEBUG] 2016-12-20 14:22:35,526 SDK: twInfoTable_CreateFromJson: Non-infotable format passed in. Using single entry '_content_'
[DEBUG] 2016-12-20 14:22:35,526 RestThingworx: Executing request AddEdgeThing
[TRACE] 2016-12-20 14:22:35,526 jsonConfigurator::getString: Key = host, Parent = rest_interface
[TRACE] 2016-12-20 14:22:35,526 jsonConfigurator::getValueByType: Parent rest_interface not found
[DEBUG] 2016-12-20 14:22:35,526 WsEmsProxy::bindThing: Host specified as 'localhost'. Testing IPV6/IPV4 connectivity
[TRACE] 2016-12-20 14:22:35,527 WsEmsProxy::bindThing: Adding Thing PiThing to binding list
[DEBUG] 2016-12-20 14:22:35,527 WsEmsProxy::bindThing: Entity PiThing already in Binding list. Updating info.
[DEBUG] 2016-12-20 14:22:35,527 jsonConfigurator::getJsonEntity: Parent file not found
[TRACE] 2016-12-20 14:22:35,527 RestThingworx: Responding with content:
[DEBUG] 2016-12-20 14:22:35,527 TlsStream::doclose: Disconeccting socket
[DEBUG] 2016-12-20 14:22:35,528 SDK: twTlsClient_Close: Disconnecting from server
[DEBUG] 2016-12-20 14:22:35,528 [+0100] HTTP Server: 0.0.0.0 - SeqId 2 - "POST /Thingworx/Things/LocalEms/Services/AddEdgeThing HTTP/1.1" 200 0 "-"
[DEBUG] 2016-12-20 14:22:35,528 SDK: twTlsClient_Close: Disconnecting from server
[DEBUG] 2016-12-20 14:22:35,530 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2016-12-20 14:22:35,530 TlsStream:: doopen: Setting SO_RCVTIMEO
[TRACE] 2016-12-20 14:22:35,530 TlsStream:: doopen: Non-SSL server socket opened
[TRACE] 2016-12-20 14:22:35,530 httpServer: Allocating new client: 3
[TRACE] 2016-12-20 14:22:35,531 client_thread::execute: Starting request handler thread 4
[DEBUG] 2016-12-20 14:22:35,531 RestThingworx::callback: Handling request
[DEBUG] 2016-12-20 14:22:35,531 SDK: twInfoTable_CreateFromJson: Non-infotable format passed in. Using single entry '_content_'
[DEBUG] 2016-12-20 14:22:35,531 RestThingworx: Executing request GetPropertySubscriptions
[TRACE] 2016-12-20 14:22:35,531 SDK: Sending Msg >>>>>>>>>
Message Details:
Version: 1
Method/Code: 0x3 (POST)
RequestID: 3
EndpointID:0
SessionID: 11
Multipart: 0
EntityType: THING
EntityName: PiThing
CharacteristicType: SERVICES
CharateristicName: GetPropertySubscriptions
Parameter Type: INFOTABLE
DataShape:
Name: _content_ BaseType: JSON
Row 1:
BaseType: JSON Value: {} Length: 2
[DEBUG] 2016-12-20 14:22:35,600 SDK: twWs_SendMessage: Sent 76 bytes using 1 frames.
[TRACE] 2016-12-20 14:22:35,600 SDK: Sent Message >>>>
01 03 00 00 00 03 00 00 00 00 00 00 00 0B 00 0A 07 50 69 54 68 69 6E 67 02 18 47 65 74 50 72 6F 70 65 72 74 79 53 75 62 73 63 72 69 70 74 69 6F 6E 73 00 05 01 09 5F 63 6F 6E 74 65 6E 74 5F 00 08 00 00 00 01 00 01 08 02 7B 7D 00
[TRACE] 2016-12-20 14:22:35,600 SDK: twMessage_Send: Message with RequestId 3 sent successfully
[TRACE] 2016-12-20 14:22:35,716 SDK: twWs_Receive: Read 2 bytes into header buffer
[TRACE] 2016-12-20 14:22:35,716 SDK: twWs_Receive: Got Header: Body length = 85
[TRACE] 2016-12-20 14:22:35,716 SDK: twWs_Receive: Header Data:
82 55
[TRACE] 2016-12-20 14:22:35,716 SDK: twWs_Receive: Read 85 bytes into Frame buffer
[TRACE] 2016-12-20 14:22:35,717 SDK: twWs_Receive: Got Body:
01 A0 00 00 00 03 00 00 00 00 FF FF FF FF 00 01 43 45 6E 74 69 74 79 20 50 69 54 68 69 6E 67 20 64 6F 65 73 20 6E 6F 74 20 65 78 69 73 74 20 6F 72 20 69 73 20 6E 6F 74 20 79 65 74 20 61 73 73 6F 63 69 61 74 65 64 20 77 69 74 68 20 61 20 54 68 69 6E 67 FF
[TRACE] 2016-12-20 14:22:35,717 SDK: twWs_Receive: Received Binary Message in Single Frame
[TRACE] 2016-12-20 14:22:35,717 SDK: msgHandlerOnBinaryMessage: Rcvd Message <<<<
01 A0 00 00 00 03 00 00 00 00 FF FF FF FF 00 01 43 45 6E 74 69 74 79 20 50 69 54 68 69 6E 67 20 64 6F 65 73 20 6E 6F 74 20 65 78 69 73 74 20 6F 72 20 69 73 20 6E 6F 74 20 79 65 74 20 61 73 73 6F 63 69 61 74 65 64 20 77 69 74 68 20 61 20 54 68 69 6E 67 FF
[TRACE] 2016-12-20 14:22:35,717 SDK: msgHandlerOnBinaryMessage: Inserting message onto queue. ID: 3, Type: 2
[TRACE] 2016-12-20 14:22:35,721 SDK: twMessageHandler_msgHandlerTask: Received Binary Message ID: 3
[TRACE] 2016-12-20 14:22:35,721 SDK: Recv'd Msg <<<<<<<<<
Message Details:
Version: 1
Method/Code: 0xa0 (INTERNAL_SERVER_ERROR)
RequestID: 3
EndpointID:0
SessionID: -1
Multipart: 0
Reason: Entity PiThing does not exist or is not yet associated with a Thing
Result Type: UNKNOWN
The most prominent lines from the LSR log are the following:
[TRACE] 2016-12-20 14:22:51,393 HttpResponse::on_message_begin: Response started
[TRACE] 2016-12-20 14:22:51,393 HttpResponse::on_message_complete: Response complete. Code: 200 Reason:
[DEBUG] 2016-12-20 14:22:51,393 TlsStream::doclose: Disconeccting socket
[DEBUG] 2016-12-20 14:22:51,393 SDK: twTlsClient_Close: Disconnecting from server
[TRACE] 2016-12-20 14:22:51,393 HttpClient::processReq: Response received. Response code = 200
[TRACE] 2016-12-20 14:22:51,393 HttpResponse::getBody: Attempting to read body as single string. m_contentLength: 154
[TRACE] 2016-12-20 14:22:51,393 HttpResponse::getBody: Read body as single string. m_body: {"rows":[{"isConnected":true}],"datashape":{"fieldDefinitions":{"isConnected":{"name":"isConnected","description":"","baseType":"BOOLEAN","aspects":{}}}}}
[DEBUG] 2016-12-20 14:22:51,393 SDK: twTlsClient_Close: Disconnecting from server
[INFO ] 2016-12-20 14:22:51,394 PiThing: EMS is available: true, online: true
[INFO ] 2016-12-20 14:22:51,394 PiThing: Attempting to GetPropertySubscriptions from server failed. code: 500, result:
[TRACE] 2016-12-20 14:22:51,394 PiThing: Attempting to set property upToDate
[TRACE] 2016-12-20 14:22:51,395 PiThing: Found handler inmemory
[DEBUG] 2016-12-20 14:22:51,395 PiThing: Wrote property: upToDate Updated updateTime to 4294967295
[TRACE] 2016-12-20 14:22:51,395 setProperty: Code: 200 Msg nil
[TRACE] 2016-12-20 14:22:51,395 GetPropertySubscriptions: Code: 500 Msg Attempting to GetPropertySubscriptions from server failed. code: 500, result:
Any help is appreciated!
Best regards,
Sebastian

