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

Unable to connect sample thing from Raspberry PI to ThingWorx EMS using Java SDK

Srinivas-MD
7-Bedrock

Unable to connect sample thing from Raspberry PI to ThingWorx EMS using Java SDK

HI,

I have seen through all the discussions posted here,but seems even after setting up the SSL on tomcat i get same error.

I used both ws (http - port 8087) and wss (https - port 8443), seems in both cases i get below error, i even checked the websockets echo request, i get proper response and also disabled the firewall on my ThingWorx VM and on Raspberry PI. but no luck.

I have JDK 8 on Raspberry PI and also in my host system.

Can some one help me on this please.

Log as below:

for http URL:

01:23:55.552 [com.ptcmanaged.tempthing.Main.main()] DEBUG c.p.tempthing.BaseEdgeServer - EDGE SERVER STARTING....

01:23:55.608 [com.ptcmanaged.tempthing.Main.main()] INFO  c.t.c.c.p.ClientMessageProcessor - Created new ClientMessageProcessor [minPoolSize: 4, maxPoolSize: 10, maxThreadLife: 10000, maxQueueSize: 1000]

01:23:55.637 [com.ptcmanaged.tempthing.Main.main()] DEBUG com.ptcmanaged.tempthing.Main - Connecting to ws://192.168.29.163:8087/Thingworx/WS using key 7d3de718-dfcf-4e26-b8d5-9f97b0ba72bd

01:23:55.645 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework

01:23:55.648 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16

01:23:55.653 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent0 - sun.nio.ch.DirectBuffer.cleaner(): available

01:23:55.654 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available

01:23:55.654 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available

01:23:55.654 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available

01:23:55.655 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true

01:23:55.656 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - Platform: Windows

01:23:55.657 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - Java version: 7

01:23:55.657 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false

01:23:55.657 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available

01:23:55.658 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false

01:23:55.658 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable

01:23:55.658 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes.  Please check the configuration for better performance.

01:23:55.659 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\srini\AppData\Local\Temp (java.io.tmpdir)

01:23:55.659 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)

01:23:55.659 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false

01:23:55.675 [com.ptcmanaged.tempthing.Main.main()] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false

01:23:55.676 [com.ptcmanaged.tempthing.Main.main()] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512

01:23:55.705 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8

01:23:55.705 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8

01:23:55.705 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192

01:23:55.706 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11

01:23:55.706 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216

01:23:55.707 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512

01:23:55.707 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256

01:23:55.708 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64

01:23:55.708 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768

01:23:55.708 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192

01:23:55.709 [com.ptcmanaged.tempthing.Main.main()] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheCleanupInterval: 5000 ms

01:23:55.715 [com.ptcmanaged.tempthing.Main.main()] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - Initializing CommunicationEndpoint Connection Monitor...

01:23:55.716 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - CommunicationEndpoint Monitor - checking for disconnected endpoints

01:23:55.716 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect...

01:23:55.717 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

01:23:55.717 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.ClientCommunicationEndpoint - Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]

01:23:55.744 [Client-EndpointMonitor-1] DEBUG i.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0xd6edad944c18a382

01:23:55.748 [Client-EndpointMonitor-1] DEBUG i.n.channel.ChannelOutboundBuffer - -Dio.netty.threadLocalDirectBufferSize: 65536

01:23:55.749 [Client-EndpointMonitor-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144

01:23:55.757 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled

01:23:55.780 [NettyClient-NIO-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetectionLevel: simple

01:23:55.792 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.ThingworxClientConnectionHandler - WebSocket Channel is connected [is open: true]

01:23:55.795 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocketClientHandshaker13 - WebSocket version 13 client handshake key: jfcfQHPQ4tZdOfM5mbleXA==, expected response: 30NuzpOtKKYdZ9vdIIRvSIzhmQs=

01:24:05.761 [Client-EndpointMonitor-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - forcing underlying tcp channel closed [is open: false, is active: false]

01:24:05.764 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://192.168.29.163:8087/Thingworx/WS] failed : timeout waiting for websocket handshake to complete

01:24:05.766 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]

For https URL:

C:\Users\srini\temperature-thing\target>java -jar temperature-thing-jar-with-dependencies.jar wss://192.168.29.163:8443/Thingworx/WS 7d3de718-dfcf-4e26-b8d5-9f97b0ba72bd simulated

03:50:46.104 [main] DEBUG c.p.tempthing.BaseEdgeServer - EDGE SERVER STARTING....

03:50:46.173 [main] INFO  c.t.c.c.p.ClientMessageProcessor - Created new ClientMessageProcessor [minPoolSize: 4, maxPoolSize: 10, maxThreadLife: 10000, maxQueueSize: 1000]

03:50:46.206 [main] DEBUG com.ptcmanaged.tempthing.Main - Connecting to wss://192.168.29.163:8443/Thingworx/WS using key 7d3de718-dfcf-4e26-b8d5-9f97b0ba72bd

03:50:46.213 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework

03:50:46.215 [main] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16

03:50:46.221 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.nio.ch.DirectBuffer.cleaner(): available

03:50:46.221 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available

03:50:46.222 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available

03:50:46.225 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available

03:50:46.225 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: true

03:50:46.226 [main] DEBUG i.n.util.internal.PlatformDependent - Platform: Windows

03:50:46.226 [main] DEBUG i.n.util.internal.PlatformDependent - Java version: 8

03:50:46.227 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false

03:50:46.228 [main] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available

03:50:46.232 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false

03:50:46.232 [main] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable

03:50:46.235 [main] DEBUG i.n.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes.  Please check the configuration for better performance.

03:50:46.237 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\srini\AppData\Local\Temp (java.io.tmpdir)

03:50:46.238 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)

03:50:46.238 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false

03:50:46.252 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false

03:50:46.252 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512

03:50:46.499 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8

03:50:46.499 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8

03:50:46.501 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192

03:50:46.502 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11

03:50:46.505 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216

03:50:46.505 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512

03:50:46.506 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256

03:50:46.507 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64

03:50:46.507 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768

03:50:46.508 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192

03:50:46.508 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheCleanupInterval: 5000 ms

03:50:46.514 [main] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - Initializing CommunicationEndpoint Connection Monitor...

03:50:46.515 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - CommunicationEndpoint Monitor - checking for disconnected endpoints

03:50:46.515 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect...

03:50:46.518 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

03:50:46.518 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.ClientCommunicationEndpoint - Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]

03:50:46.528 [Client-EndpointMonitor-1] DEBUG i.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x37d404df17f88253

03:50:46.532 [Client-EndpointMonitor-1] DEBUG i.n.channel.ChannelOutboundBuffer - -Dio.netty.threadLocalDirectBufferSize: 65536

03:50:46.534 [Client-EndpointMonitor-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144

03:50:46.541 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled

03:50:46.550 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.NettyClientConnectionFactory - initializing a secure websocket connection [ignore ssl errors: true]

03:50:47.181 [NettyClient-NIO-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetectionLevel: simple

03:50:47.212 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.ThingworxClientConnectionHandler - WebSocket Channel is connected [is open: true]

03:50:47.215 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocketClientHandshaker13 - WebSocket version 13 client handshake key: 0+Zt9govcpotnw1WlltKRw==, expected response: QNuChs5pK6D7vUjhCjRawVvkdTA=

03:50:47.226 [NettyClient-NIO-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - TRUST-ALL X509TrustManager.checkServerTrusted called [issuer: CN=PTC PTC, OU=PTC, O=PTC, L=Ann Arbor, ST=MI, C=US, subject: CN=PTC PTC, OU=PTC, O=PTC, L=Ann Arbor, ST=MI, C=US, authType: ECDHE_RSA]

03:50:47.226 [NettyClient-NIO-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - TRUST-ALL X509TrustManager.getAcceptedIssuers called

03:50:56.547 [Client-EndpointMonitor-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - forcing underlying tcp channel closed [is open: false, is active: false]

03:50:56.549 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: wss://192.168.29.163:8443/Thingworx/WS] failed : timeout waiting for websocket handshake to complete

03:50:56.554 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]

Visit: http://www.windchillguru.com
7 REPLIES 7

Can you see your ThingWorx Composer web page when you browse to 192.168.29.163:8087/Thingworx/Composer/index.html

Unless you are using an additional connection server, whatever URL:port works for browsing to composer will work for the EMS. You will have to set the security options in config.json to match your server security

Hi Al,

I don't think i am using additional connection server and i am able to access composer as well.

i am trying out the sample weather app, i don't see any config.json in that project.

Visit: http://www.windchillguru.com

When you browse to Composer does the URL start with http;// or https:// and is there any port after the host name or IP address?

Whatever hostname/IP address and port you use to browse to Composer will be what need to be in the json.config file on the Raspberry Pi. For example, if you browse to Composer using http://192.168.29.163 then you will need to enter this in json.config:

"ws_servers":[{
"host":"192.168.29.163",
"port":80
}]


You will also need to add this to json.config:

"ws_connection":{
"encryption":"none"

}

Hi Al,

the URL which i use for accessing composer are as below

http://192.168.29.163:8087/Thingworx/Composer/

or

https://192.168.29.163:8443/Thingworx/Composer/


Can you tell me the location on raspberry pi where i need to place this json.config file please.

Visit: http://www.windchillguru.com

Based on your log files you must have been changing it.

There is a step-by-step guide here:

http://developer.thingworx.com/guides/thingworx-raspberry-pi-quickstart?page=5

Start in whatever directory the EMS is installed in and thn change to microserver/etc

Srinivas Dwarakanath​,

I tried accessing the url and it's not accessible. Maybe it's accessible within your vpn or instance is down.

Could you please confirm that the Ports 8443 and 8087 are open on the server where ThingWorx is Running.

It isn't very clear, but these lines in the log file:

01:24:05.761 [Client-EndpointMonitor-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - forcing underlying tcp channel closed [is open: false, is active: false]

01:24:05.764 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://192.168.29.163:8087/Thingworx/WS] failed : timeout waiting for websocket handshake to complete

Mean that there is no network connection to the ThingWorx server

Announcements
Top Tags