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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Java SDK tutorial can't connect to hosted trial server

justinoberle
10-Marble

Java SDK tutorial can't connect to hosted trial server

I am currently stuck on step 3 of the java SDK tutorial. The java code can't connect to the hosted trial server. I have tried many different things but it should be pretty straight forward. What am I doing wrong. I have followed the instructions exactly. Here is the error messages in eclipse...

 

12:14:51.529 [Client-EndpointMonitor-1] ERROR c.t.c.c.c.n.NettyClientConnectionFactory - Exception occurred while connecting to server
java.lang.NullPointerException: null
at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory$ChannelPipelineInitializer.<init>(NettyClientConnectionFactory.java:466) ~[thingworx-communications-client-development.server.build-b679.jar:na]
at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory.createConnection(NettyClientConnectionFactory.java:390) ~[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]
12:14:51.529 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: pp-2007131735uf.devportal.ptc.io/Thingworx] failed : null
12:14:51.529 [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]
12:14:51.529 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]
12:14:52.530 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.ConnectivityMonitorTask - Entering duty cycle ON
12:14:52.530 [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...
12:15:21.967 [main] WARN c.thingworx.sdk.simple.SimpleClient - Client did not connect within 30 seconds. Exiting
12:15:21.967 [main] INFO c.t.communications.client.BaseClient - CommunicationEndpoint Monitor - STOPPING...
12:15:21.968 [main] INFO c.t.communications.client.BaseClient - CommunicationEndpoint Monitor - OFF
12:15:21.968 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - CommunicationEndpoint Monitor was interrupted, system is probably shutting down
12:15:21.968 [Client-EndpointMonitor-1] INFO c.t.c.c.e.m.ConnectivityMonitorTask - CommunicationEndpoint Monitor - exiting
12:15:21.968 [main] INFO c.t.c.c.c.n.NettyClientConnectionFactory - NettyClientConnectionFactory - STOPPING
12:15:24.198 [main] INFO c.t.c.c.c.n.NettyClientConnectionFactory - NettyClientConnectionFactory - OFF
12:15:24.200 [main] DEBUG c.t.c.c.e.CommunicationEndpoint - [Endpoint id: 0] closing
12:15:24.200 [main] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]
12:15:24.203 [main] DEBUG c.t.c.c.p.ClientMessageProcessor - ClientProcessor executor service shutdown normally within soft timeout.
12:15:24.203 [main] INFO c.thingworx.sdk.simple.SimpleClient - SimpleClient is done. Exiting

1 ACCEPTED SOLUTION

Accepted Solutions

The URI should be wss://PP-2007131735UF.devportal.ptc.io:8443/Thingworx/WS for your case. Can you please try this ?

 

 

Thanks,

Mukul Narang

View solution in original post

4 REPLIES 4
yanchen
15-Moonstone
(To:justinoberle)

for http ThingWorx environment, the uri should be ws start, but for https ThingWorx environment, the uri should be wss start.

config.setUri("ws://wc111m010.tsdevtest.ptc.com:8080/Thingworx/WS");

config.setAppKey("06ca8fa1-7833-4fad-9248-9a0b61cf01d3");

 

Also you need to set thing name as well:

private static String ThingName = "SimpleThing_1";

 

Ok my app key and thingname are correct. The URI is where I am going wrong I think. I changed it to this...

 

wss://PP-2007131735UF.devportal.ptc.io/Thingworx

 

and it is still not working. PP-2007131735UF.devportal.ptc.io/Thingworx is the link to the connection. What am I missing?

The URI should be wss://PP-2007131735UF.devportal.ptc.io:8443/Thingworx/WS for your case. Can you please try this ?

 

 

Thanks,

Mukul Narang

This worked. Thanks! 

Top Tags