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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

getting java.util.concurrent.TimeoutException and java.util.concurrent.RejectedExecutionException after the thingworx session is expired on client (java edge sdk)

kborkar
12-Amethyst

getting java.util.concurrent.TimeoutException and java.util.concurrent.RejectedExecutionException after the thingworx session is expired on client (java edge sdk)

Exception are mentioned below:

Connected thingworx with java through java edge sdk and ran a program continuously but after some time it starts giving below two exceptions:

(Our guess is, might be thingworx session timeout.)


java.util.concurrent.TimeoutException: timeout waiting for websocket handshake to complete

  at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory$HandshakeCompletionNotifier.await(NettyClientConnectionFactory.java:565) ~[thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory.createConnection(NettyClientConnectionFactory.java:308) ~[thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.refillConnections(ClientCommunicationEndpoint.java:225) ~[thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.dutyCycleOn(ConnectivityMonitorTask.java:150) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.run(ConnectivityMonitorTask.java:264) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_66]

  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_66]

  at java.lang.Thread.run(Unknown Source) [na:1.8.0_66]

java.util.concurrent.RejectedExecutionException: event executor terminated

  at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:706) ~[netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:298) ~[netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:689) ~[netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.channel.AbstractChannel$AbstractUnsafe.register(AbstractChannel.java:421) ~[netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:60) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.channel.SingleThreadEventLoop.register(SingleThreadEventLoop.java:48) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.channel.MultithreadEventLoopGroup.register(MultithreadEventLoopGroup.java:64) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:315) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.bootstrap.Bootstrap.doConnect(Bootstrap.java:134) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:116) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:97) [netty-all-4.0.30.Final.jar:4.0.30.Final]

  at com.thingworx.communications.client.connection.netty.NettyClientConnectionFactory.createConnection(NettyClientConnectionFactory.java:305) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.refillConnections(ClientCommunicationEndpoint.java:225) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.dutyCycleOn(ConnectivityMonitorTask.java:150) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.run(ConnectivityMonitorTask.java:264) [thingworx-communications-client-java-sdk-6.0.1.server.build-b255.jar:na]

  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_66]

  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_66]

  at java.lang.Thread.run(Unknown Source) [na:1.8.0_66]

18:36:30.430 [Client-EndpointMonitor-156] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 13628]

18:36:30.430 [Client-EndpointMonitor-156] INFO  c.t.c.c.e.ClientCommunicationEndpoint - Needed to refill connections on client endpoint [id: 13628] : [active: 0, max: 1]

18:36:30.430 [Client-EndpointMonitor-156] WARN  io.netty.channel.AbstractChannel - Force-closing a channel whose registration task was not accepted by an event loop: [id: 0xa29bd793]

6 REPLIES 6
posipova
20-Turquoise
(To:kborkar)

Could you please provide your configuration information? Do you have an SSL encryption - if so, please ensure the URL syntax is correct (wss vs ws)?

supandey
19-Tanzanite
(To:kborkar)

Kedar, in addition to what Polina mentioned, could you also share what sort of operation service is performing/actions performed while the connection is working. It appears as though the blocking operation in thread is timing out.

ankigupta
12-Amethyst
(To:kborkar)

Hi Kedar Borkar​, Please check following article containing same error: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS250773&lang=en_US

I hope it helps.

Thanks,

Ankit Gupta

kborkar
12-Amethyst
(To:ankigupta)

Thanks for the reply,

Ankit Gupta Initially i tried connecting thingworx with "wss://ThingWorxServer:443/Thingworx/WS" but i was getting error message.

So, i tried connecting using ws and it worked.

please guide me how to create wss connection with thingworx and avoid that ssl error.

Thanks

ankigupta
12-Amethyst
(To:kborkar)

Hi Kedar,

Please refer to following article for detail on how to setup ssl in ThingWorx: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS193947&lang=en_US

Thanks,

Ankit Gupta

jgorsline
12-Amethyst
(To:kborkar)

Kedar,

Any update on this? Was Ankit Gupta's post helpful? If so, could you click on the "correct answer" or "mark as helpful" button and let us know?

Announcements


Top Tags