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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Error connecting raspberry pi using ssl

aricci
1-Visitor

Error connecting raspberry pi using ssl

I have no problem connecting using port 8080 however I have tried multiple configurations and am not able to connect to tomcat using SSL.

(1) I have 2 ports open (8080 and 8443), although if I disconnect port 8080, it still does not work.  Server.xml below:

    <Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

    <Connector

   port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"

   maxThreads="150" SSLEnabled="true" scheme="https" secure="true" sslProtocol="TLS"

   keystoreFile="conf/tomcat.keystore" keystorePass="XXXXXXX"

   clientAuth="false" truststoreFile="conf/truststore.jks" truststorePass="XXXXX">

   </Connector>

(2) on the pi my config.json, this works:

{

"ws_servers": [{
   "host": "192.168.20.37",
   "port": 8080
  }],
 
"appKey": "f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1",

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

"http_server":  {
  "host": "127.0.0.1",
  "port": 9080
},
     "logger":   {
         "level":    "TRACE"
     },
     "auto_bind":    [{
             "name": "RedPi",
             "gateway":  false
         }],
     "certificates": {
         "validate": false,
         "allow_self_signed":    true
     },
     "ws_connection":    {
         "encryption":   "none",
         "verbose":  true,
         "msg_timeout":  1000
      }
}

-- THIS DOES NOT WORK

{

"ws_servers": [{
   "host": "192.168.20.37",
   "port": 8443
  }],
 
"appKey": "f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1",

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

"http_server":  {
  "host": "127.0.0.1",
  "port": 9080
},
     "logger":   {
         "level":    "TRACE"
     },
     "auto_bind":    [{
             "name": "RedPi",
             "gateway":  false
         }],
     "certificates": {
         "validate": false,
         "allow_self_signed":    true
     },
     "ws_connection":    {
         "encryption":   "none",
         "verbose":  true,
         "msg_timeout":  1000
      }
}

-- here is the log

pi@piRed:~/ems/microserver $ sudo ./wsems
[INFO ] 2017-05-30 15:44:42,861 ./wsems: Using config file: /home/pi/ems/microserver                                /etc/config.json
[FORCE] 2017-05-30 15:44:42,862 ./wsems: Starting up ....
[TRACE] 2017-05-30 15:44:42,862 jsonConfigurator::getString: Key = audit_target, Par                                ent = logger
[TRACE] 2017-05-30 15:44:42,862 jsonConfigurator::getValueByType: Key audit_target n                                ot found
[TRACE] 2017-05-30 15:44:42,863 jsonConfigurator::getString: Key = publish_directory                                , Parent = logger
[TRACE] 2017-05-30 15:44:42,863 jsonConfigurator::getValueByType: Key publish_direct                                ory not found
[TRACE] 2017-05-30 15:44:42,863 jsonConfigurator::getUnsignedInteger: Key = max_file                                _storage, Parent = logger
[TRACE] 2017-05-30 15:44:42,864 jsonConfigurator::getValueByType: Key max_file_stora                                ge not found
[TRACE] 2017-05-30 15:44:42,864 jsonConfigurator::getString: Key = publish_level, Pa                                rent = logger
[TRACE] 2017-05-30 15:44:42,864 jsonConfigurator::getValueByType: Key publish_level                                 not found
[TRACE] 2017-05-30 15:44:42,864 jsonConfigurator::getBoolean: Key = auto_flush, Pare                                nt = logger
[TRACE] 2017-05-30 15:44:42,864 jsonConfigurator::getValueByType: Key auto_flush not                                 found
[FORCE] 2017-05-30 15:44:42,865 ./wsems: Initializing EMS ....
[FORCE] 2017-05-30 15:44:42,865 main: Using config file /home/pi/ems/microserver/etc                                /config.json
[INFO ] 2017-05-30 15:44:42,865 ./wsems: Creating the WsEms proxy.
[TRACE] 2017-05-30 15:44:42,865 wsEmsProxy::wsEmsProxy: Constructor called
[INFO ] 2017-05-30 15:44:42,865 ./wsems: Starting HTTP Server.
[TRACE] 2017-05-30 15:44:42,866 jsonConfigurator::getInteger: Key = port, Parent = h                                ttp_server
[TRACE] 2017-05-30 15:44:42,866 jsonConfigurator::getString: Key = host, Parent = ht                                tp_server
[TRACE] 2017-05-30 15:44:42,866 jsonConfigurator::getBoolean: Key = ssl, Parent = ht                                tp_server
[TRACE] 2017-05-30 15:44:42,866 jsonConfigurator::getValueByType: Key ssl not found
[TRACE] 2017-05-30 15:44:42,867 jsonConfigurator::getString: Key = certificate, Pare                                nt = http_server
[TRACE] 2017-05-30 15:44:42,867 jsonConfigurator::getValueByType: Key certificate no                                t found
[TRACE] 2017-05-30 15:44:42,867 jsonConfigurator::getBoolean: Key = authenticate, Pa                                rent = http_server

192.168.20.37:8443-->[TRACE] 2017-05-30 15:44:42,867 jsonConfigurator::getValueByTyp                                e: Key authenticate not found
[TRACE] 2017-05-30 15:44:42,868 jsonConfigurator::getInteger: Key = content_read_tim                                eout, Parent = http_server
[TRACE] 2017-05-30 15:44:42,868 jsonConfigurator::getValueByType: Key content_read_t                                imeout not found
[INFO ] 2017-05-30 15:44:42,869 ./wsems: Initializing the ThingWorx REST interface.
[TRACE] 2017-05-30 15:44:42,869 wsEmsProxy::initialize: Method entered
[FORCE] 2017-05-30 15:44:42,870 httpServer: Method entered
[TRACE] 2017-05-30 15:44:42,870 jsonConfigurator::getString: Key = level, Parent = l                                ogger
[TRACE] 2017-05-30 15:44:42,870 jsonConfigurator::getBoolean: Key = verbose, Parent                                 = ws_connection
[TRACE] 2017-05-30 15:44:42,871 jsonConfigurator::getString: Key = encryption, Paren                                t = ws_connection
[TRACE] 2017-05-30 15:44:42,871 jsonConfigurator::getString: Key = user, Parent =
[TRACE] 2017-05-30 15:44:42,871 jsonConfigurator::getValueByType: Key user not found
[TRACE] 2017-05-30 15:44:42,871 jsonConfigurator::getString: Key = password, Parent                                 =
[TRACE] 2017-05-30 15:44:42,871 jsonConfigurator::getValueByType: Key password not f                                ound
[TRACE] 2017-05-30 15:44:42,872 jsonConfigurator::getString: Key = appkey, Parent =
[TRACE] 2017-05-30 15:44:42,872 jsonConfigurator::getString: Key = resource, Parent                                 =
[TRACE] 2017-05-30 15:44:42,872 jsonConfigurator::getValueByType: Key resource not f                                ound
[TRACE] 2017-05-30 15:44:42,872 jsonConfigurator::getInteger: Key = port, Parent = p                                roxy
[TRACE] 2017-05-30 15:44:42,872 jsonConfigurator::getValueByType: Parent proxy not f                                ound
[TRACE] 2017-05-30 15:44:42,873 jsonConfigurator::getString: Key = host, Parent = pr                                oxy
[TRACE] 2017-05-30 15:44:42,873 jsonConfigurator::getValueByType: Parent proxy not f                                ound
[TRACE] 2017-05-30 15:44:42,873 jsonConfigurator::getString: Key = user, Parent = pr                                oxy
[TRACE] 2017-05-30 15:44:42,873 jsonConfigurator::getValueByType: Parent proxy not f                                ound
[TRACE] 2017-05-30 15:44:42,873 jsonConfigurator::getString: Key = password, Parent                                 = proxy
[TRACE] 2017-05-30 15:44:42,874 jsonConfigurator::getValueByType: Parent proxy not f                                ound
[TRACE] 2017-05-30 15:44:42,874 jsonConfigurator::getUnsignedInteger: Key = socket_r                                ead_timeout, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,874 jsonConfigurator::getValueByType: Key socket_read_ti                                meout not found
[TRACE] 2017-05-30 15:44:42,874 jsonConfigurator::getUnsignedInteger: Server socket                                 error: Address already in use [127.0.0.1:9080]
[ERROR] 2017-05-30 15:44:42,874 httpserver: Server socket error: Address already in                                 use [127.0.0.1:9080]
[TRACE] 2017-05-30 15:44:42,875 jsonConfigurator::getValueByType:
[ERROR] 2017-05-30 15:44:42,875 httpServer:
[TRACE] 2017-05-30 15:44:42,875 jsonConfigurator::getUnsignedInteger: Key = ssl_read                                _timeout, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,875 jsonConfigurator::getValueByType: Key ssl_read_timeo                                ut not found
[TRACE] 2017-05-30 15:44:42,875 jsonConfigurator::getUnsignedInteger: Key = msg_time                                out, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getUnsignedInteger: Key = ping_rat                                e, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getValueByType: Key ping_rate not                                 found
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getUnsignedInteger: Key = pingpong                                _timeout, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getValueByType: Key pingpong_timeo                                ut not found
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getUnsignedInteger: Key = max_thre                                ads, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getValueByType: Key max_threads no                                t found
[TRACE] 2017-05-30 15:44:42,876 jsonConfigurator::getUnsignedInteger: Key = max_msg_                                size, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getValueByType: Key max_msg_size n                                ot found
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getUnsignedInteger: Key = max_mess                                ages, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getValueByType: Key max_messages n                                ot found
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getBoolean: Key = verbose, Parent                                 = ws_connection
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getBoolean: Key = connect_on_deman                                d, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getValueByType: Key connect_on_dem                                and not found
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getUnsignedInteger: Key = max_conn                                ect_delay, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,877 jsonConfigurator::getValueByType: Key max_connect_de                                lay not found
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getUnsignedInteger: Key = connect_                                period, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getValueByType: Key connect_period                                 not found
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getUnsignedInteger: Key = duty_cyc                                le, Parent = ws_connection
[ERROR] 2017-05-30 15:44:42,878 httpserver: Server socket error: Address already in                                 use [127.0.0.1:9081]
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getValueByType: Server socket erro                                r: Address already in use [127.0.0.1:9081]
[ERROR] 2017-05-30 15:44:42,878 httpServer: unable to bind http server to port=9081,                                 trying next port.
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getUnsignedInteger: Key = message_                                idle_time, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getValueByType: Key message_idle_t                                ime not found
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getUnsignedInteger: Key = connect_                                timeout, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getValueByType: Key connect_timeou                                t not found
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getUnsignedInteger: Key = connect_                                retry_interval, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,878 jsonConfigurator::getValueByType: Key connect_retry_                                interval not found
[TRACE] 2017-05-30 15:44:42,879 jsonConfigurator::getInteger: Key = connect_retries,                                 Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,879 jsonConfigurator::getValueByType: Key connect_retrie                                s not found
[TRACE] 2017-05-30 15:44:42,879 jsonConfigurator::getBoolean: Key = enabled, Parent                                 = offline_msg_store
[TRACE] 2017-05-30 15:44:42,879 jsonConfigurator::getValueByType: Parent offline_msg                                _store not found
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getString: Key = directory, Parent                                 = offline_msg_store
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getValueByType: Parent offline_msg                                _store not found
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getUnsignedInteger: Key = max_size                                , Parent = offline_msg_store
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getValueByType: http server bound                                 to port=9082.
[DEBUG] 2017-05-30 15:44:42,880 httpServer: http server bound to port=9082.
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getUnsignedInteger: Key = message_                                chunk_size, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,880 jsonConfigurator::getValueByType: Key message_chunk_                                size not found
[DEBUG] 2017-05-30 15:44:42,881 SDK: twWs_Create: Initializing Websocket Client for                                 192.168.20.37:8443//Thingworx/WS
[DEBUG] 2017-05-30 15:44:42,881 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2017-05-30 15:44:42,881 SDK: twApi_Initialize: Websocket Established after 0                                 tries
[DEBUG] 2017-05-30 15:44:42,881 SDK: subscribedPropsMgr_Initialize: Initializing sub                                scribed properties manager
[TRACE] 2017-05-30 15:44:42,881 jsonConfigurator::getBoolean: Key = validate, Parent                                 = certificates
[TRACE] 2017-05-30 15:44:42,881 jsonConfigurator::getBoolean: Key = deny_self_signed                                , Parent = certificates
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getValueByType: Key deny_self_sign                                ed not found
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getBoolean: Key = allow_self_signe                                d, Parent = certificates
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getString: Key = client_cert, Pare                                nt = certificates
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getValueByType: Key client_cert no                                t found
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getString: Key = key_file, Parent                                 = certificates
[TRACE] 2017-05-30 15:44:42,882 jsonConfigurator::getValueByType: Key key_file not f                                ound
[TRACE] 2017-05-30 15:44:42,883 jsonConfigurator::getString: Key = key_passphrase, P                                arent = certificates
[TRACE] 2017-05-30 15:44:42,883 jsonConfigurator::getValueByType: Key key_passphrase                                 not found
[DEBUG] 2017-05-30 15:44:42,883 jsonConfigurator::getJsonEntity: Key cert_chain not                                 found
[DEBUG] 2017-05-30 15:44:42,883 jsonConfigurator::getJsonEntity: Key validation_crit                                eria not found
[TRACE] 2017-05-30 15:44:42,883 jsonConfigurator::getString: Key = staging_dir, Pare                                nt = file
[TRACE] 2017-05-30 15:44:42,884 jsonConfigurator::getValueByType: Parent file not fo                                und
[TRACE] 2017-05-30 15:44:42,884 jsonConfigurator::getUnsignedInteger: Key = buffer_s                                ize, Parent = file
[TRACE] 2017-05-30 15:44:42,884 jsonConfigurator::getValueByType: Parent file not fo                                und
[TRACE] 2017-05-30 15:44:42,884 jsonConfigurator::getDouble: Key = max_file_size, Pa                                rent = file
[TRACE] 2017-05-30 15:44:42,884 jsonConfigurator::getValueByType: Parent file not fo                                und
[DEBUG] 2017-05-30 15:44:42,884 jsonConfigurator::getJsonEntity: Parent file not fou                                nd
[TRACE] 2017-05-30 15:44:42,885 SDK: twFileManager_AddVirtualDir: Adding __staging__                                 to vdir list
[TRACE] 2017-05-30 15:44:42,885 WsEmsProxy::bindThing: Adding Thing RedPi to binding                                 list
[DEBUG] 2017-05-30 15:44:42,885 jsonConfigurator::getJsonEntity: Parent file not fou                                nd
[INFO ] 2017-05-30 15:44:42,886 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2017-05-30 15:44:42,886 ./wsems: Starting the connection.
[TRACE] 2017-05-30 15:44:42,886 jsonConfigurator::getInteger: Key = connect_retry_in                                terval, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,886 jsonConfigurator::getValueByType: Key connect_retry_                                interval not found
[TRACE] 2017-05-30 15:44:42,886 jsonConfigurator::getInteger: Key = max_connect_dela                                y, Parent = ws_connection
[TRACE] 2017-05-30 15:44:42,886 jsonConfigurator::getValueByType: Key max_connect_de                                lay not found
[TRACE] 2017-05-30 15:44:42,887 SDK: twApi_Connect: Delaying 0 milliseconds before c                                onnecting
[DEBUG] 2017-05-30 15:44:42,887 SDK: twTlsClient_Reconnect: Re-establishing SSL cont                                ext
[DEBUG] 2017-05-30 15:44:42,887 SDK: twTlsClient_Connect: Connecting to server
[TRACE] 2017-05-30 15:44:42,887 SDK: twWs_Connect: Connected to 192.168.20.37:8443
[TRACE] 2017-05-30 15:44:42,887 SDK: twWs_Connect: Sent request:
GET /Thingworx/WS HTTP/1.1
User-Agent: ThingWorx C SDK
Upgrade: websocket
Connection: Upgrade
Host: 192.168.20.37
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: K2wSDrgRu5z6f1o/qirv4g==
Max-Frame-Size: 8192
appKey: f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1


[ERROR] 2017-05-30 15:44:52,869 SDK: twWs_Connect: Error trying to connect
[DEBUG] 2017-05-30 15:44:52,869 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:44:52,870 SDK: twTlsClient_Connect: Connecting to server
[DEBUG] 2017-05-30 15:44:57,871 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:44:57,872 SDK: twTlsClient_Connect: Connecting to server
[TRACE] 2017-05-30 15:44:57,873 SDK: twWs_Connect: Connected to 192.168.20.37:8443
[TRACE] 2017-05-30 15:44:57,873 SDK: twWs_Connect: Sent request:
GET /Thingworx/WS HTTP/1.1
User-Agent: ThingWorx C SDK
Upgrade: websocket
Connection: Upgrade
Host: 192.168.20.37
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: Vsg3bgTpTfPat+g++S1gWA==
Max-Frame-Size: 8192
appKey: f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1


[ERROR] 2017-05-30 15:45:07,872 SDK: twWs_Connect: Error trying to connect
[DEBUG] 2017-05-30 15:45:07,872 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:07,873 SDK: twTlsClient_Connect: Connecting to server
[DEBUG] 2017-05-30 15:45:12,873 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:12,874 SDK: twTlsClient_Connect: Connecting to server
[TRACE] 2017-05-30 15:45:12,875 SDK: twWs_Connect: Connected to 192.168.20.37:8443
[TRACE] 2017-05-30 15:45:12,875 SDK: twWs_Connect: Sent request:
GET /Thingworx/WS HTTP/1.1
User-Agent: ThingWorx C SDK
Upgrade: websocket
Connection: Upgrade
Host: 192.168.20.37
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 4c60G//iroTJJ/xUrbO4cQ==
Max-Frame-Size: 8192
appKey: f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1


[ERROR] 2017-05-30 15:45:22,875 SDK: twWs_Connect: Error trying to connect
[DEBUG] 2017-05-30 15:45:22,876 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:22,876 SDK: twTlsClient_Connect: Connecting to server
[DEBUG] 2017-05-30 15:45:27,877 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:27,877 SDK: twTlsClient_Connect: Connecting to server
[TRACE] 2017-05-30 15:45:27,878 SDK: twWs_Connect: Connected to 192.168.20.37:8443
[TRACE] 2017-05-30 15:45:27,878 SDK: twWs_Connect: Sent request:
GET /Thingworx/WS HTTP/1.1
User-Agent: ThingWorx C SDK
Upgrade: websocket
Connection: Upgrade
Host: 192.168.20.37
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: b3FYTKV+0GgloJgR2ykkHQ==
Max-Frame-Size: 8192
appKey: f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1


[ERROR] 2017-05-30 15:45:37,878 SDK: twWs_Connect: Error trying to connect
[DEBUG] 2017-05-30 15:45:37,878 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:37,879 SDK: twTlsClient_Connect: Connecting to server
[DEBUG] 2017-05-30 15:45:42,882 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:42,883 SDK: twTlsClient_Connect: Connecting to server
[TRACE] 2017-05-30 15:45:42,885 SDK: twWs_Connect: Connected to 192.168.20.37:8443
[TRACE] 2017-05-30 15:45:42,885 SDK: twWs_Connect: Sent request:
GET /Thingworx/WS HTTP/1.1
User-Agent: ThingWorx C SDK
Upgrade: websocket
Connection: Upgrade
Host: 192.168.20.37
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: TT6oGnLX5utZrbaC9YS7bw==
Max-Frame-Size: 8192
appKey: f109ecb5-9e2b-4215-8d3f-6479d5d6b9c1


[WARN ] 2017-05-30 15:45:42,901 Main: Unable to connect to server.  Trying .booted config file
[ERROR] 2017-05-30 15:45:52,885 SDK: twWs_Connect: Error trying to connect
[DEBUG] 2017-05-30 15:45:52,886 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2017-05-30 15:45:52,886 SDK: twTlsClient_Connect: Connecting to server
[WARN ] 2017-05-30 15:45:57,887 WsEmsProxy::execute() : Server connection failed.  Error Code: 201
[FORCE] 2017-05-30 15:45:57,988 Main: Shutdown signal received. Restarting ....
[TRACE] 2017-05-30 15:45:57,989 wsEmsProxy::~wsEmsProxy: Destructor called
[TRACE] 2017-05-30 15:45:57,989 WsProxy::~WsProxy: Deleting Thing binding list
[TRACE] 2017-05-30 15:45:57,989 SDK: Sending Msg >>>>>>>>>
Message Details:
Version: 1
Method/Code: 0xb (UNBIND)
RequestID: 1
EndpointID:0
SessionID: 0
Multipart: 0
Count: 1
Name: RedPi

[DEBUG] 2017-05-30 15:45:57,990 SDK: twMessage_Send: Not authenticated yet
[ERROR] 2017-05-30 15:45:57,990 SDK: twMessage_Send: Error sending Message with RequestId 1
[ERROR] 2017-05-30 15:45:57,990 SDK: twApi_UnbindThing: Error creating sending Unbind message
[DEBUG] 2017-05-30 15:45:57,990 SDK: twMessage_Delete:  Deleting BIND Message: 1
terminate called without an active exception
pi@piRed:~/ems/microserver $

ACCEPTED SOLUTION

Accepted Solutions
supandey
19-Tanzanite
(To:aricci)

Hi Anthony, in both of the json.configs why do you have certificates section twice? Additionally if you are attempting to connect in encrypted mode you'd want to have something like this

  "ws_connection":    {

         "encryption":   "SSL",

However you have it disabled. The configuration seems a bit off could you please refer to the ThingWorx WebSocket -based Edge Microserver Deverloper's Guide for correct configuration

Hope this'd help.

View solution in original post

3 REPLIES 3
supandey
19-Tanzanite
(To:aricci)

Hi Anthony, in both of the json.configs why do you have certificates section twice? Additionally if you are attempting to connect in encrypted mode you'd want to have something like this

  "ws_connection":    {

         "encryption":   "SSL",

However you have it disabled. The configuration seems a bit off could you please refer to the ThingWorx WebSocket -based Edge Microserver Deverloper's Guide for correct configuration

Hope this'd help.

aricci
1-Visitor
(To:supandey)

Sushant,

Do you mind looking at my client auth settings?  I set up tomcat to perform a client auth, I have a client certificate and referenced it wihtin the config.json however it appears that the EMS is passing some other certificate other than mine.  It appears to be a default certificate from thingworx which is not in the defined config file.

config.json:

{

  "ws_servers": [{

  "host": "XXXXXXXX",

  "port": 8443

  }],

  "appKey": "XXXXXX",

      "certificates": {

      "validate": true,

      "client_cert": "/home/pi/ems/microserver/keystore/client.cer",

      "cert_chain": [ "/home/pi/ems/microserver/keystore/CA.cer" ],

      "key_file":  "/home/pi/ems/microserver/keystore/keyenc.pem", 

      "key_passphrase": "XXXXXX"

  },

  "http_server":  {

  "host": "127.0.0.1",

  "port": 9080

  },

     "logger":   {

         "level":    "TRACE"

     },

     "auto_bind":    [{

             "name": "RedPi",

             "gateway":  false

         }],

     "ws_connection":    {

         "encryption":   "SSL",

         "verbose":  true,

         "msg_timeout":  1000

    }

}

This is from wireshark, this is the certificate that is being passed to the server as the client certificate with my request:

(id-at-commonName=MicroServer,id-at-organizationalUnitName=Edge,id-at-organizationName=ThingWorx,id-at-localityName=Exton,id-at-stateOrProvinceName=Pennsylvania,id-at-countryName=US)

aricci
1-Visitor
(To:aricci)

Thank you, I cannot believe I missed that setting.  it is working now.  Thanks!!!!!!

Announcements


Top Tags