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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Hosted trial will not connect via Java SDK

justinoberle
10-Marble

Hosted trial will not connect via Java SDK

I Started a new hosted trial and it is version 9.0. I am using the same code I used to connect with the old trial except I changed the app key and URI to match the new hosted trial. I am getting these errors when trying to connect....

13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.c.n.NettyClientConnectionFactory - Exception occurred while connecting to server
java.lang.IllegalArgumentException: port out of range:-1

 

and...

13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: wss://pp-2008121712nk.devportal.ptc.io/Thingworx/WS] failed : null
13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Exception refilling connections was:
java.lang.NullPointerException: null

 

 

here is the complete console....

13:03:00.770 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
13:03:00.780 [main] DEBUG i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16
13:03:00.801 [main] DEBUG i.n.util.internal.PlatformDependent - Platform: Windows
13:03:00.804 [main] DEBUG i.n.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
13:03:00.804 [main] DEBUG i.n.util.internal.PlatformDependent0 - Java version: 8
13:03:00.806 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
13:03:00.806 [main] DEBUG i.n.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
13:03:00.807 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
13:03:00.807 [main] DEBUG i.n.util.internal.PlatformDependent0 - direct buffer constructor: available
13:03:00.809 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
13:03:00.809 [main] DEBUG i.n.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
13:03:00.809 [main] DEBUG i.n.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
13:03:00.809 [main] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available
13:03:00.810 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\JUSTIN~1.OBE\AppData\Local\Temp (java.io.tmpdir)
13:03:00.810 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
13:03:00.811 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
13:03:00.811 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: 3786407936 bytes
13:03:00.811 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
13:03:00.812 [main] DEBUG io.netty.util.internal.CleanerJava6 - java.nio.ByteBuffer.cleaner(): available
13:03:00.829 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
13:03:00.829 [main] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
13:03:00.836 [main] DEBUG i.n.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 16
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 16
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
13:03:01.114 [main] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
13:03:01.116 [main] DEBUG i.n.u.i.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
13:03:01.116 [main] DEBUG i.n.u.i.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
13:03:01.123 [main] INFO c.t.c.c.p.ClientMessageProcessor - Created new ClientMessageProcessor [minPoolSize: 4, maxPoolSize: 10, maxThreadLife: 10000, maxQueueSize: 1000]
13:03:01.124 [main] DEBUG c.t.c.c.e.m.ConnectivityMonitorTask - Initializing CommunicationEndpoint Connection Monitor...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
13:03:01.126 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.ConnectivityMonitorTask - Resetting duty cycle
13:03:01.127 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.ConnectivityMonitorTask - Entering duty cycle ON
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
13:03:01.127 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect in 0 seconds...
13:03:01.127 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]
13:03:01.127 [Client-EndpointMonitor-1] INFO c.t.c.c.e.ClientCommunicationEndpoint - Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]
13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.c.n.NettyClientConnectionFactory - Exception occurred while connecting to server
java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.checkPort(Unknown Source) ~[na:1.8.0_231]
at java.net.InetSocketAddress.createUnresolved(Unknown Source) ~[na:1.8.0_231]
at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:126) ~[netty-all-4.1.15.Final.jar:4.1.15.Final]
at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory.createConnection(NettyClientConnectionFactory.java:395) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.refillConnections(ClientCommunicationEndpoint.java:230) [thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.dutyCycleOn(ConnectivityMonitorTask.java:159) [thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.run(ConnectivityMonitorTask.java:306) [thingworx-communications-client-development.server.build-b679.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_231]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_231]
13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: wss://pp-2008121712nk.devportal.ptc.io/Thingworx/WS] failed : null
13:03:01.139 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Exception refilling connections was:
java.lang.NullPointerException: null
at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory.createConnection(NettyClientConnectionFactory.java:411) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.refillConnections(ClientCommunicationEndpoint.java:230) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.dutyCycleOn(ConnectivityMonitorTask.java:159) [thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.run(ConnectivityMonitorTask.java:306) [thingworx-communications-client-development.server.build-b679.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_231]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_231]
13:03:01.140 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]
13:03:02.155 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.ConnectivityMonitorTask - Entering duty cycle ON
13:03:02.155 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect in 60 seconds...
13:03:31.358 [main] WARN c.t.s.simplething.SimpleThingClient - Client did not connect within 30 seconds. Exiting
13:03:31.358 [main] INFO c.t.s.simplething.SimpleThingClient - SimpleThingClient is done. Exiting

1 ACCEPTED SOLUTION

Accepted Solutions

Ah I got it. I was using the wrong port number. I used this one and it works now. Thanks!

wss://pp-2008121712nk.devportal.ptc.io:8443/Thingworx/WS

 

Just so I don't go crazy, where do I find out what port number I am using? I used the old one 8443 and it worked but I never knew where it came from.

View solution in original post

5 REPLIES 5

Can you add the port to your URI? I have a feeling the old URL contained the port and maybe this was forgotten when you copy/pasted the new URI.

I have tried these with no luck

wss://pp-2008121712nk.devportal.ptc.io/Thingworx/WS ///////// this is way I had it set up on the old hosted trial

wss://pp-2008121712nk.devportal.ptc.io:90/Thingworx/WS ///////// tried setting a port number and get a timeout waiting for websocket handshake

wss://pp-2008121712nk.devportal.ptc.io:80/Thingworx/WS //////// same as above

ws://pp-2008121712nk.devportal.ptc.io/Thingworx/WS ///////// same as first

 

No luck with these

Ah I got it. I was using the wrong port number. I used this one and it works now. Thanks!

wss://pp-2008121712nk.devportal.ptc.io:8443/Thingworx/WS

 

Just so I don't go crazy, where do I find out what port number I am using? I used the old one 8443 and it worked but I never knew where it came from.

The rule is typically simple:

-if your webserver exposes "https" for Composer, and you see no port specified in the URL, then the port will be always 443

-the same logic would apply for "http", but only in this case the port would be 80

 

Try with 443 instead of 8443, it should work (I'm actually surprised 8443 is open).

Thank! 443 works as well. I will use this one.

Top Tags