Unable to start EMS using wsems
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Unable to start EMS using wsems
I have a Thingworx foundation server and am trying to get the EMS started on the same machine, but am having some trouble. These are the steps I have followed:
1. I installed MED-61060-CD-053_SP5_Microserver-5-3-4-2383-Win32
2. I configured the config.json file with this (the app key is from my ThingWorx application key
"ws_servers": [{
"host": "localhost",
"port": 8080
}],
"appKey": "c03fa7e6-ab2f-47bd-9b0b-3d93e2bd03c9"
[FORCE] 2020-04-17 03:44:43,187 wsems: Starting up ....
[FORCE] 2020-04-17 03:44:43,187 wsems: Initializing EMS ....
[FORCE] 2020-04-17 03:44:43,187 main: Using config file C:\ems\microserver\etc\config.json
[FORCE] 2020-04-17 03:44:43,192 httpServer: starting http server port=8000
: Couldn't bind address [*:8000]
[ERROR] 2020-04-17 03:44:44,242 SDK: Error intializing socket connection. Err = -1
[ERROR] 2020-04-17 03:44:44,242 SDK: twWs_Connect: Error restarting socket. Error 0
Adrian
Solved! Go to Solution.
- Labels:
-
TWX Dev Portal
- Tags:
- edge microserver
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @apdams
your config.json does not show anything on port 8000, shouldn't you check the url http://192.168.1.33:8084/Thingworx/Things/LocalEms/Properties/isConnected instead ?
Christophe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I think I am making progress, but still not all the way there.
I changed my config.json to look like this:
{
"ws_servers": [{
"host": "192.168.1.33",
"port": 80
}],
"appKey": "c03fa7e6-ab2f-47bd-9b0b-3d93e2bd03c9",
"logger": {
"publish_directory": "logs",
"level": "DEBUG",
"publish_level": "INFO",
"max_file_storage": 2000000,
"auto_flush": true,
"flush_chunk_size": 16384,
"buffer_size": 4096
},
"ws_connection": {
"encryption": "none",
"verbose": true
},
"http_server" : {
"host": "192.168.1.33",
"port": 8084,
"ssl": false,
"content_read_timeout": 20000,
"authenticate": false
},
"file": {
"virtual_dirs": [
{"logs": "logs"},
{"instruction":"instruction"}
],
"staging_dir": "c:\\ems\\microserver\\staging"
}
}
From the output when I run wsems, I think it is getting further. This is the output:
s\microserver\etc\config.json
[FORCE] 2020-04-17 04:30:08,55 wsems: Starting up ....
[FORCE] 2020-04-17 04:30:08,55 wsems: Initializing EMS ....
[FORCE] 2020-04-17 04:30:08,55 main: Using config file C:\ems\microserver\etc\co
nfig.json
[INFO ] 2020-04-17 04:30:08,55 wsems: Creating the WsEms proxy.
[INFO ] 2020-04-17 04:30:08,55 wsems: Starting HTTP Server.
[INFO ] 2020-04-17 04:30:08,55 wsems: Initializing the ThingWorx REST interface.
or 192.168.1.33:80//Thingworx/WS
[DEBUG] 2020-04-17 04:30:08,55 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2020-04-17 04:30:08,60 SDK: twApi_Initialize: Websocket Established afte
r 0 tries
[DEBUG] 2020-04-17 04:30:08,60 SDK: subscribedPropsMgr_Initialize: Initializing
subscribed properties manager
[DEBUG] 2020-04-17 04:30:08,60 jsonConfigurator::getJsonEntity: Parent certifica
tes not found
[DEBUG] 2020-04-17 04:30:08,60 jsonConfigurator::getJsonEntity: Parent certifica
tes not found
[DEBUG] 2020-04-17 04:30:08,60 SDK: twTunnelManager_Create: Tunnel Manager singl
eton already exists
[DEBUG] 2020-04-17 04:30:08,60 jsonConfigurator::getJsonEntity: Key auto_bind no
t found
[INFO ] 2020-04-17 04:30:08,60 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2020-04-17 04:30:08,60 wsems: Starting the connection.
[FORCE] 2020-04-17 04:30:08,65 httpServer: starting http server port=8084
[DEBUG] 2020-04-17 04:30:08,65 httpServer: http server bound to port=8084.
[DEBUG] 2020-04-17 04:30:08,85 SDK: twTlsClient_Reconnect: Re-establishing SSL c
ontext
[DEBUG] 2020-04-17 04:30:08,85 SDK: twTlsClient_Connect: Connecting to server
[ERROR] 2020-04-17 04:30:08,85 SDK: twWs_Connect: Error initializing web socket.
Response code: 404
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Sharon
I have (I think) made more progress.
This is my latest config file (changed the ws_servers port to 8080):
{
"ws_servers": [{
"host": "192.168.1.33",
"port": 8080
}],
"appKey": "c03fa7e6-ab2f-47bd-9b0b-3d93e2bd03c9",
"logger": {
"publish_directory": "logs",
"level": "DEBUG",
"publish_level": "INFO",
"max_file_storage": 2000000,
"auto_flush": true,
"flush_chunk_size": 16384,
"buffer_size": 4096
},
"ws_connection": {
"encryption": "none",
"verbose": true
},
"http_server" : {
"host": "192.168.1.33",
"port": 8084,
"ssl": false,
"content_read_timeout": 20000,
"authenticate": false
},
"certificates":{
"validate":false,
"allow_self_signed":true
},
"file": {
"virtual_dirs": [
{"logs": "logs"},
{"instruction":"instruction"}
],
"staging_dir": "c:\\ems\\microserver\\staging"
}
}
Now, when I run wsems on the command prompt, it sort of looks like it is working. This is what I get:
[FORCE] 2020-04-17 05:28:45,236 wsems: Starting up ....
[FORCE] 2020-04-17 05:28:45,236 wsems: Initializing EMS ....
[FORCE] 2020-04-17 05:28:45,236 main: Using config file C:\ems\microserver\etc\config.json
[INFO ] 2020-04-17 05:28:45,236 wsems: Creating the WsEms proxy.
[INFO ] 2020-04-17 05:28:45,236 wsems: Starting HTTP Server.
[INFO ] 2020-04-17 05:28:45,236 wsems: Initializing the ThingWorx REST interface.
[INFO ] 2020-04-17 05:28:45,241 wsEmsProxy::initialize: Initialization complete!
[FORCE] 2020-04-17 05:28:45,246 httpServer: starting http server port=8084
[INFO ] 2020-04-17 05:28:45,271 SDK: twWs_Connect: Websocket connected!
[INFO ] 2020-04-17 05:28:45,306 Main: Succesfully connected. Saving .booted config file
rows | |
0 | |
isConnected | false |
datashape | |
fieldDefinitions | |
isConnected | |
name | "isConnected" |
description | "" |
baseType | "BOOLEAN" |
aspects | {} |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @apdams
your config.json does not show anything on port 8000, shouldn't you check the url http://192.168.1.33:8084/Thingworx/Things/LocalEms/Properties/isConnected instead ?
Christophe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
i Christophe
That was it.
Thanks a lot
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Christophe
Something very strange has happened. Earlier, my EMS was working and I could query the connected status and it was returning true. I am running the same config file, but now I am getting this in the output and the connected status is false:
\ems\microserver\etc\config.json
[FORCE] 2020-04-17 10:21:21,302 wsems: Starting up ....
[FORCE] 2020-04-17 10:21:21,302 wsems: Initializing EMS ....
[FORCE] 2020-04-17 10:21:21,302 main: Using config file C:\ems\microserver\etc\config.json
[INFO ] 2020-04-17 10:21:21,302 wsems: Creating the WsEms proxy.
[INFO ] 2020-04-17 10:21:21,302 wsems: Starting HTTP Server.
[INFO ] 2020-04-17 10:21:21,302 wsems: Initializing the ThingWorx REST interface.
[INFO ] 2020-04-17 10:21:21,317 wsEmsProxy::initialize: Initialization complete!
[FORCE] 2020-04-17 10:21:21,317 httpServer: starting http server port=8084
[INFO ] 2020-04-17 10:21:21,357 SDK: twWs_Connect: Websocket connected!
[WARN ] 2020-04-17 10:21:21,362 SDK: api:sendMessageBlocking: AUTH Message 1 failed. Code:
[WARN ] 2020-04-17 10:21:26,367 SDK: twWs_Connect: Already connected
[WARN ] 2020-04-17 10:21:26,367 SDK: twWs_Receive: Websocket closed!
[WARN ] 2020-04-17 10:21:26,367 SDK: msgHandlerOnClose: WEBSOCKET CLOSED
[WARN ] 2020-04-17 10:21:26,372 SDK: api:sendMessageBlocking: Receive failed.
[WARN ] 2020-04-17 10:21:26,372 SDK: api:sendMessageBlocking: Message 2 timed out
What is happening here?
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Turns out to be the application key had expired.
Suggestion: the error message "api:sendMessageBlocking: Receive failed." is not particularly useful. Something like "application key has expired" would be more useful
