Skip to main content
15-Moonstone
Feb 7, 2018 12:44 PM UTC
Solved

Java SDK - Tunneling Remote Desktop

Hello,

 

I am trying to set up tunneling in my Java App for Remote Desktop purposes.

 

Background:

  • Java SDK 6.1
    • Netty 4.1.21 ?
  • ThingWorx 8.0/8.1
  • UltraVNC

 

Java App Configuration:

twxClientConfigurator.setUri(AppProperties.getAppProperties().getProperty("thingworx.uri"));
twxClientConfigurator.setAppKey(AppProperties.getAppProperties().getProperty("thingworx.appKey"));
twxClientConfigurator.ignoreSSLErrors(true);
twxClientConfigurator.tunnelsEnabled(true);

 

On the ThingWorx side everything is configured as it should be:

1.PNG

2.PNG3.PNG

 

The Error which I am receiving, while trying to download wsadpater.jsp file:

5.PNG

 

An the ThingWorx logs:

Remote access attempt failed for tunnel name vnc on remote thing Remote access attempt failed for tunnel name vnc on remote thing mything. mything does not support tunneling.

 

It is very urgent. Hope someone can help me.

15-Moonstone
Feb 7, 2018 1:51 PM UTC

I am ashamed about it, but I found the source:

Instead of this:

this.createTWXClientConfig();
thingClient = new ThingClient(this.twxClientConfigurator);

I was doing this:

thingClient = new ThingClient(this.twxClientConfigurator);

this.createTWXClientConfig();

Now the fun part:

In createTWXClientConfig() method I was setting up URI & appKey. In both cases I was able to connect to the Platform without any issues, but tunneling was not working in 2nd case...

Now everything is ok.

Thanks,

Adam

5 replies

5-Regular Member
Feb 7, 2018 1:27 PM UTC

I feel like this is something "simple" such as the mashup is misconfigured. I will search our internal tracker and see if something simple comes up.  Double chceck that you have the mashup configured correctly and that the thing has the tunnel configured etc. I'll follow-up in a bit (if nobody else does)

Translate
5-Regular Member
Feb 7, 2018 1:29 PM UTC

One more place to check is in %userprofile%\ThingworxRemoteAccess\thingworx_tunneler.log (assuming windows, $HOME if not). is there anything helpful in there?    

Translate
15-Moonstone
Feb 7, 2018 1:35 PM UTC

Hi Clint,

Thanks for response. What's funny I created Unit test with very simple use case:

final String ThingName = "TunnelThing2";
ClientConfigurator config = new ClientConfigurator();
config.setUri("ws://localhost:8080/Thingworx/WS");
config.setAppKey("7edabf28-8ed6-4f99-9326-bb04b04c9dd7");
config.ignoreSSLErrors(true);
config.tunnelsEnabled(true);
try {

  ConnectedThingClient client = new ConnectedThingClient(config);
   VirtualThing myThing = new VirtualThing(ThingName, "Tunnel Example", client);
   client.bindThing(myThing);
   client.start();
  while (!client.isShutdown()) {

  Thread.sleep(5000);
   }

} catch (Exception e) {

  e.printStackTrace();
}

This app is working perfectly as an Unit Test in the same application. Will try to add it to the Jar and test it as well.

Mashup is working fine for this asset from Unit Test.

Probably there is an issue with thread's or something like that. Will check it one more time.

Thanks,

Adam

Translate