cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR Connecting WS EMS on Raspberry Pi

SOLVED
Guest

ERROR Connecting WS EMS on Raspberry Pi

Hi,

i want to install the WS EMS on my Raspberry Pi.

 

When I execute wsems, following error occurs:

~/microserver % sudo ./wsems
[FORCE] 2018-09-05 08:51:01,119 ./wsems: Initializing EMS ....
[FORCE] 2018-09-05 08:51:01,119 main: Using config file /home/nexiles/microserver/etc/config.json
[WARN ] 2018-09-05 08:51:01,120 Main: Authentication is disabled on the HTTP Server.
[FORCE] 2018-09-05 08:51:01,120 httpServer: starting http server port=8000
[WARN ] 2018-09-05 08:51:01,123 SDK: SDK Version: 2.1.2
[WARN ] 2018-09-05 08:51:01,123 SDK: TLS Library: OpenSSL
[WARN ] 2018-09-05 08:51:01,123 SDK: TLS Library Version: 1.0.2l-fips
[WARN ] 2018-09-05 08:51:01,123 SDK: FIPS Capable
[WARN ] 2018-09-05 08:51:01,143 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-09-05 08:51:01,143 WsProxy::initialize: Self signed certificates are enabled.
[ERROR] 2018-09-05 08:51:01,146 SDK: twMap_Add: parse function returned null.

192.168.100.164:443-->[ERROR] 2018-09-05 08:51:01,150 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:11,152 SDK: twWs_Connect: Error trying to connect
[ERROR] 2018-09-05 08:51:11,152 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:16,154 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:26,155 SDK: twWs_Connect: Error trying to connect
[ERROR] 2018-09-05 08:51:26,155 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:31,156 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:41,158 SDK: twWs_Connect: Error trying to connect
[ERROR] 2018-09-05 08:51:41,158 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:46,160 SDK: twStream_Delete: NULL Pointer passed in
[ERROR] 2018-09-05 08:51:56,162 SDK: twWs_Connect: Error trying to connect
[ERROR] 2018-09-05 08:51:56,163 SDK: twStream_Delete: NULL Pointer passed in
[WARN ] 2018-09-05 08:52:01,166 Main: Unable to connect to server.  Trying .booted config file
[WARN ] 2018-09-05 08:52:01,167 WsEmsProxy::execute() : Server connection failed.  Error Code: 201
[FORCE] 2018-09-05 08:52:06,180 Main: Shutdown signal received. Restarting ....
[WARN ] 2018-09-05 08:52:16,209 SDK: sendCtlFrame: Not connected
[WARN ] 2018-09-05 08:52:16,210 SDK: msgHandlerOnClose: WEBSOCKET CLOSED
[WARN ] 2018-09-05 08:52:16,211 SDK: sendCtlFrame: Not connected
[FORCE] 2018-09-05 08:52:16,213 ./wsems: Initializing EMS ....
[FORCE] 2018-09-05 08:52:16,214 main: Using config file /home/nexiles/microserver/etc/config.json.booted
[WARN ] 2018-09-05 08:52:16,215 Main: Authentication is disabled on the HTTP Server.
[FORCE] 2018-09-05 08:52:16,216 httpServer: starting http server port=8000
[WARN ] 2018-09-05 08:52:16,219: SDK Version: 2.1.2
[WARN ] 2018-09-05 08:52:16,219: TLS Library: OpenSSL
[WARN ] 2018-09-05 08:52:16,219: TLS Library Version: 1.0.2l-fips
[WARN ] 2018-09-05 08:52:16,219: FIPS Capable
[WARN ] 2018-09-05 08:52:16,223 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-09-05 08:52:16,223 WsProxy::initialize: Self signed certificates are enabled.
[ERROR] 2018-09-05 08:52:16,225: twMap_Add: parse function returned null.

192.168.100.164:443-->[ERROR] 2018-09-05 08:52:16,228: twStream_Delete: NULL Pointer passed in

 

This is my config file:

{
        "ws_servers":   [{
                        "host": "192.168.100.164",
                        "port": 443
                }],
        "appKey":       "********-****-****-****-************",
        "http_server": {
                "use_default_certificate" : true,
                "ssl" : true,
                "authenticate" : false
        },

        "certificates": {
                "validate": false,
                "allow_self_signed": true
        },

        "ws_connection": {
                "encryption": "none",
                "verbose": false
        }
}

Does anyone know how i could fix this problem?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: ERROR Connecting WS EMS on Raspberry Pi

You are required to have a logger config section:

 

 "logger": {
"level":"DEBUG"
},

I was able to reproduce the :

[ERROR] 2018-09-05 13:08:40,458 SDK: twMap_Add: parse function returned null.


when I removed the logger configuration. You can set to INFO if you want less output

4 REPLIES 4

Re: ERROR Connecting WS EMS on Raspberry Pi

The http_server section of the EMS config file is for the local server that the EMS starts - not the EMS connection to the ThingWorx Server.

 

The ws_connection section controls the EMS connection to the ThingWorx server. Try this:

 

"http_server": {

    "ssl": false,
    "authenticate": false
},

"ws_connection": {
    "encryption": "ssl"
}

 

Re: ERROR Connecting WS EMS on Raspberry Pi

Thanks for your reply.

Unfortunately I still get an error:

sudo ./wsems                                                                                                                                                                                                                   :( [FORCE] 2018-09-05 13:08:40,430 ./wsems: Initializing EMS ....
[FORCE] 2018-09-05 13:08:40,430 main: Using config file /home/nexiles/microserver/etc/config.json
[WARN ] 2018-09-05 13:08:40,431 Main: Encryption is disabled on HTTP Server.
[WARN ] 2018-09-05 13:08:40,431 Main: Authentication is disabled on the HTTP Server.
[FORCE] 2018-09-05 13:08:40,432 httpServer: starting http server port=8000
[WARN ] 2018-09-05 13:08:40,435 SDK: SDK Version: 2.1.2
[WARN ] 2018-09-05 13:08:40,435 SDK: TLS Library: OpenSSL
[WARN ] 2018-09-05 13:08:40,435 SDK: TLS Library Version: 1.0.2l-fips
[WARN ] 2018-09-05 13:08:40,435 SDK: FIPS Capable
[WARN ] 2018-09-05 13:08:40,455 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-09-05 13:08:40,456 WsProxy::initialize: Self signed certificates are enabled.
[ERROR] 2018-09-05 13:08:40,458 SDK: twMap_Add: parse function returned null.

192.168.100.164:443-->[ERROR] 2018-09-05 13:08:40,461 SDK: twStream_Delete: NULL Pointer passed in
[WARN ] 2018-09-05 13:08:40,561 SDK: api:sendMessageBlocking: AUTH Message 1 failed. Code:129
[WARN ] 2018-09-05 13:08:45,561 SDK: twWs_Connect: Already connected
[WARN ] 2018-09-05 13:08:45,562 SDK: twWs_Receive: Websocket closed!
[WARN ] 2018-09-05 13:08:45,562 SDK: msgHandlerOnClose: WEBSOCKET CLOSED
[WARN ] 2018-09-05 13:08:45,563 SDK: api:sendMessageBlocking: Receive failed.
[WARN ] 2018-09-05 13:08:45,563 SDK: api:sendMessageBlocking: Message 2 timed out
[ERROR] 2018-09-05 13:08:50,564 SDK: twStream_Delete: NULL Pointer passed in
[WARN ] 2018-09-05 13:08:50,673 SDK: api:sendMessageBlocking: AUTH Message 3 failed. Code:129

My config file:

{
        "ws_servers":   [{
                        "host": "192.168.100.164",
                        "port": 443
                }],
        "appKey":       "d9c999e1-c645-4e25-9f77-d3d49cfeb2c1",
        "http_server": {
                "ssl" : false,
                "authenticate" : false
        },

        "certificates": {
                "validate": false,
                "allow_self_signed": true
        },

        "ws_connection": {
                "encryption": "ssl"
        }
}

 What am I doing wrong?

Re: ERROR Connecting WS EMS on Raspberry Pi

You are required to have a logger config section:

 

 "logger": {
"level":"DEBUG"
},

I was able to reproduce the :

[ERROR] 2018-09-05 13:08:40,458 SDK: twMap_Add: parse function returned null.


when I removed the logger configuration. You can set to INFO if you want less output

Re: ERROR Connecting WS EMS on Raspberry Pi

Thank you! The error still appears but it looks like the server is connected now

 

~/microserver % sudo ./wsems
[FORCE] 2018-09-05 13:55:43,539 ./wsems: Initializing EMS ....
[FORCE] 2018-09-05 13:55:43,539 main: Using config file /home/nexiles/microserver/etc/config.json
[INFO ] 2018-09-05 13:55:43,539 ./wsems: Creating the WsEms proxy.
[INFO ] 2018-09-05 13:55:43,539 ./wsems: Starting HTTP Server.
[INFO ] 2018-09-05 13:55:43,540 Main: Using custom certificate and private key for HTTP Server
[WARN ] 2018-09-05 13:55:43,540 Main: Encryption is disabled on HTTP Server.
[WARN ] 2018-09-05 13:55:43,540 Main: Authentication is disabled on the HTTP Server.
[INFO ] 2018-09-05 13:55:43,541 ./wsems: Initializing the ThingWorx REST interface.
[FORCE] 2018-09-05 13:55:43,541 httpServer:
[INFO ] 2018-09-05 13:55:43,541 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2018-09-05 13:55:43,541 wsEmsProxy::initialize: Encryption is enabled on Web Socket connection.
[WARN ] 2018-09-05 13:55:43,544 SDK: SDK Version: 2.1.2
[WARN ] 2018-09-05 13:55:43,544 SDK: TLS Library: OpenSSL
[WARN ] 2018-09-05 13:55:43,544 SDK: TLS Library Version: 1.0.2l-fips
[WARN ] 2018-09-05 13:55:43,544 SDK: FIPS Capable
[DEBUG] 2018-09-05 13:55:43,544 SDK: twWs_Create: Initializing Websocket Client for 192.168.100.164:443//Thingworx/WS
[DEBUG] 2018-09-05 13:55:43,544 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2018-09-05 13:55:43,544 httpServer: http server bound to port=8000.
[DEBUG] 2018-09-05 13:55:43,565 SDK: twApi_Initialize: Websocket Established after 0 tries
[DEBUG] 2018-09-05 13:55:43,565 SDK: subscribedPropsMgr_Initialize: Initializing subscribed properties manager
[INFO ] 2018-09-05 13:55:43,565 WsProxy::initialize: EMS Version 5.4.2.334
[INFO ] 2018-09-05 13:55:43,565 WsProxy::initialize: twApi singleton initialized
[WARN ] 2018-09-05 13:55:43,565 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-09-05 13:55:43,565 WsProxy::initialize: Self signed certificates are enabled.
[DEBUG] 2018-09-05 13:55:43,566 jsonConfigurator::getJsonEntity: Key validation_criteria not found
[DEBUG] 2018-09-05 13:55:43,567 jsonConfigurator::getJsonEntity: Parent file not found
[DEBUG] 2018-09-05 13:55:43,567 SDK: twTunnelManager_Create: Tunnel Manager singleton already exists
[ERROR] 2018-09-05 13:55:43,568 SDK: twMap_Add: parse function returned null.
[DEBUG] 2018-09-05 13:55:43,568 jsonConfigurator::getJsonEntity: Key auto_bind not found
[INFO ] 2018-09-05 13:55:43,568 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2018-09-05 13:55:43,570 ./wsems: Starting the connection.

192.168.100.164:443-->[ERROR] 2018-09-05 13:55:43,572 SDK: twStream_Delete: NULL Pointer passed in
[DEBUG] 2018-09-05 13:55:43,573 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2018-09-05 13:55:43,573 SDK: twTlsClient_Connect: Connecting to server
[DEBUG] 2018-09-05 13:55:43,634 SDK: twTlsClient_Connect: TLS connection established
[INFO ] 2018-09-05 13:55:43,638 SDK: Server supports websocket extensions: permessage-deflate
[DEBUG] 2018-09-05 13:55:43,639 SDK: ws_on_headers_complete: Websocket connected!
[INFO ] 2018-09-05 13:55:43,639 SDK: twWs_Connect: Websocket connected!
[DEBUG] 2018-09-05 13:55:43,641 SDK: twWs_SendMessage: Sent 60 bytes using 1 frames.
[DEBUG] 2018-09-05 13:55:43,681 SDK: twMessage_Delete:  Deleting RESPONSE Message: 1
[DEBUG] 2018-09-05 13:55:43,682 SDK: twMessage_Delete:  Deleting AUTH Message: 1
[DEBUG] 2018-09-05 13:55:43,686 SDK: sendCtlFrame: >>>>> Sending Ping. Msg: 13:55:43
[INFO ] 2018-09-05 13:55:43,721 Main: Succesfully connected.  Saving .booted config file
[DEBUG] 2018-09-05 13:56:38,753 SDK: sendCtlFrame: >>>>> Sending Ping. Msg: 13:56:38
[DEBUG] 2018-09-05 13:57:33,820 SDK: sendCtlFrame: >>>>> Sending Ping. Msg: 13:57:33
[DEBUG] 2018-09-05 13:58:28,886 SDK: sendCtlFrame: >>>>> Sending Ping. Msg: 13:58:28