7 Replies Latest reply on Mar 1, 2017 11:48 PM by Ankit Gupta RSS
    sdwarakanath Newbie

    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]