Skip to main content
1-Visitor
April 15, 2016
Question

Error when deploying EMS with Pi temp humidity sensor.

  • April 15, 2016
  • 1 reply
  • 6784 views

(I am not the administrator for my instance)

In part 5 of the Raspberry Pi Weather Application project, I get an error when trying to connect the Pi to ThingWorx. the commands I ran are:

java -jar ./temperature-thing-jar-with-dependencies.jar ws://xxxxxx.clould.thingworx.com:80//Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80

and

java -jar ./temperature-thing-jar-with-dependencies.jar wss://xxxxxx.clould.thingworx.com//Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80

Also, when I run the simulated command from my desktop, I receive the message that the system cannot find the file, but the .jar file is clearly where it is supposed to be. Any help will be appreciated. The errors from the Pi and Windows are shown below:

From my Desktop:

C:\temperature-thing\temperature-thing\target>java -jar ./temperature-thing-jar-with-dependencies.jar wss://xxxxxxxx.cloud.thingworx.com//Thingworx/WS</thingworx b7b95994-865b-446c-ace7-b9438bdf1d80 simulated

The system cannot find the file specified.

C:\temperature-thing\temperature-thing\target>java -jar C:\temperature-thing\temperature-thing\target/temperature-thing-jar-with-dependencies.jar wss://xxxxxxxxx.cloud.thingworx.com//Thingworx/WS</thingworx b7b95994-865b-446c-ace7-b9438bdf1d80 simulated

The system cannot find the file specified.

From my Pi:

pi@raspberrypi ~ $ java -jar ./temperature-thing-jar-with-dependencies.jar ws://xxxxxx.clould.thingworx.com:80//Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80

19:19:14.662 [main] DEBUG c.p.tempthing.BaseEdgeServer - EDGE SERVER STARTING....

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

19:19:15.577 [main] DEBUG com.ptcmanaged.tempthing.Main - Connecting to ws://xxxxx.clould.thingworx.com:80//Thingworx/ws using key b7b95994-865b-446c-ace7-b9438bdf1d80

19:19:15.657 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework

19:19:15.684 [main] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8

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

19:19:15.754 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available

19:19:15.759 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available

19:19:15.763 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available

19:19:15.766 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: false

19:19:15.808 [main] DEBUG i.n.util.internal.PlatformDependent - UID: 1000

19:19:15.810 [main] DEBUG i.n.util.internal.PlatformDependent - Java version: 8

19:19:15.811 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false

19:19:15.811 [main] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available

19:19:15.814 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false

19:19:15.820 [main] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable

19:19:15.821 [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.

19:19:15.822 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)

19:19:15.824 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 32 (sun.arch.data.model)

19:19:15.824 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false

19:19:15.934 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false

19:19:15.935 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512

19:19:16.064 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 1

19:19:16.065 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 1

19:19:16.065 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192

19:19:16.066 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11

19:19:16.066 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216

19:19:16.066 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512

19:19:16.067 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256

19:19:16.067 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64

19:19:16.067 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768

19:19:16.068 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192

19:19:16.068 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheCleanupInterval: 5000 ms

19:19:16.136 [main] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - Initializing CommunicationEndpoint Connection Monitor...

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

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

19:19:16.142 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

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

19:19:16.351 [Client-EndpointMonitor-1] DEBUG i.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x1e0de45765c53dc6

19:19:16.393 [Client-EndpointMonitor-1] DEBUG i.n.channel.ChannelOutboundBuffer - -Dio.netty.threadLocalDirectBufferSize: 65536

19:19:16.399 [Client-EndpointMonitor-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144

19:19:16.491 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled

19:19:16.744 [NettyClient-NIO-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetectionLevel: simple

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

19:19:26.558 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri:

ws://stevenscollege.clould.thingworx.com:80//Thingworx/ws] failed : timeout waiting for websocket handshake to complete

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

1 reply

1-Visitor
April 18, 2016

Hi


1st question is the instance that you are connecting to HTTP or HTTPS?

2nd question : are you running the command on the pi from the directory where the jar file resides? I'll assume that you are....


If your ThingWorx instance is HTTP, then:

java -jar temperature-thing-jar-with-dependencies.jar ws://xxxxxx.clould.thingworx.com:80/Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80


Should work.


If it's HTTPS (and using default HTTPS port) then:

java -jar temperature-thing-jar-with-dependencies.jar wss://xxxxxx.clould.thingworx.com:443/Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80


should work.


In both cases I've taken out the ./ before the jar file name (as I'm assuming you're in that directory) and changed // to / before "Thingworx" in the URL. For the HTTPS example I've also added the port to the URL.


In the windows example, it won't like the ./ so take that out and also make the same updates to your URL as above.


Regards


Ian

rkelly11-VisitorAuthor
1-Visitor
April 18, 2016

After making the suggested changes and ensuring the instance is http and that I am running the command from the proper directory, the problem still persists. I am at a loss of where I can go from here. Could it be the settings on my schools network? Do the steps that take place on ThingWorx have to be done as an administrator? My results are below, thank you.

pi@raspberrypi ~ $ java -jar temperature-thing-jar-with-dependencies.jar ws://xxxxxxx.cloud.thingworx.com:80/Thingworx/ws b7b95994-865b-446c-ace7-b9438bdf1d80


19:06:55.210 [main] DEBUG c.p.tempthing.BaseEdgeServer - EDGE SERVER STARTING....

19:06:55.746 [main] INFO  c.t.c.c.p.ClientMessageProcessor - Created new ClientMessageProcessor [minPoolSize: 4, maxPoolSize: 10, maxThreadLife: 10000, maxQueueSize: 1000]

19:06:56.124 [main] DEBUG com.ptcmanaged.tempthing.Main - Connecting to ws://stevenscollege.cloud.thingworx.com:80/Thingworx/ws using key b7b95994-865b-446c-ace7-b9438bdf1d80

19:06:56.197 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework

19:06:56.229 [main] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8

19:06:56.288 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.nio.ch.DirectBuffer.cleaner(): available

19:06:56.295 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available

19:06:56.298 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available

19:06:56.302 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available

19:06:56.305 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: false

19:06:56.341 [main] DEBUG i.n.util.internal.PlatformDependent - UID: 1000

19:06:56.343 [main] DEBUG i.n.util.internal.PlatformDependent - Java version: 8

19:06:56.345 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false

19:06:56.345 [main] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available

19:06:56.348 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false

19:06:56.354 [main] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable

19:06:56.355 [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.

19:06:56.357 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)

19:06:56.358 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 32 (sun.arch.data.model)

19:06:56.358 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false

19:06:56.467 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false

19:06:56.468 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512

19:06:56.596 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 1

19:06:56.596 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 1

19:06:56.597 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192

19:06:56.597 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11

19:06:56.598 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216

19:06:56.598 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512

19:06:56.599 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256

19:06:56.599 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64

19:06:56.599 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768

19:06:56.600 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192

19:06:56.600 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheCleanupInterval: 5000 ms

19:06:56.670 [main] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - Initializing CommunicationEndpoint Connection Monitor...

19:06:56.672 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - CommunicationEndpoint Monitor - checking for disconnected endpoints

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

19:06:56.675 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

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

19:06:56.882 [Client-EndpointMonitor-1] DEBUG i.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0xaf4b25c97bc68637

19:06:56.924 [Client-EndpointMonitor-1] DEBUG i.n.channel.ChannelOutboundBuffer - -Dio.netty.threadLocalDirectBufferSize: 65536

19:06:56.930 [Client-EndpointMonitor-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144

19:06:57.028 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled

19:06:57.267 [NettyClient-NIO-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetectionLevel: simple

19:06:57.509 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.ThingworxClientConnectionHandler - WebSocket Channel is connected [is open: true]

19:06:57.535 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocketClientHandshaker13 - WebSocket version 13 client handshake key: 8v0aaujx8bk1wxBU+Sptwg==, expected response: yvddUO+WYI8WlfnvdoyW6leviwY=

19:07:07.088 [Client-EndpointMonitor-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - forcing underlying tcp channel closed [is open: false, is active: false]

19:07:07.093 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://stevenscollege.cloud.thingworx.com:80/Thingworx/ws] failed : timeout waiting for websocket handshake to complete

19:07:07.094 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]

1-Visitor
April 18, 2016

Hi

As you put the URL and appKey in the above I tested it... it may be worth creating a new AppKey and removing the existing one.

I can access your server, the user that the AppKey is linked to doesn't have many permissions.... that may not help, but isn't your main problem. I tested with a simulator that I had lying around... it connected but then was giving "Not authorised for service invoke" errors.. which is linked to your user setup.

If the school has a proxy server, that may be causing issues, I'm not sure what the Academic program has in place for configuring for these. I'll ping one of the team and see if they can advise you...

Regards

Ian