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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Thingworx Java Edge SDK connection error

jnair1
1-Newbie

Thingworx Java Edge SDK connection error

Dear Thingworx Community members,

I am trying write a Thingworx Java Edge SDK example in an OSGi environment. My example is based on the Weather application given in the Thingworx academic resource page.

During the initial connection negotiations I am getting an error "Invalid Protocol Version".  Given below is the log:

8:33:22.481 [NettyClient-NIO-41] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=60

08:33:22.506 [NettyClient-NIO-41] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2

08:33:22.507 [NettyClient-NIO-41] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=17

08:33:22.508 [NettyClient-NIO-41] ERROR c.t.c.c.c.n.ThingworxClientConnectionHandler - WebSocket error: Invalid Protocol Version [71], closing connection!

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

08:33:23.730 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint not connected [name: Am2302Thing, id: 0]. Attempting [re]connect...

08:33:23.730 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

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

08:33:24.746 [Client-EndpointMonitor-1] INFO  c.t.c.c.c.n.NettyClientConnectionFactory - forcing underlying tcp channel closed [is open: true, is active: false]

08:33:24.747 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://192.168.0.12:8080/Thingworx/WS] failed : timeout waiting for websocket handshake to complete

Does anybody have an idea what’s causing this error?

Any help would be appreciated.

Best Regards,

Jishnu

1 ACCEPTED SOLUTION

Accepted Solutions
jnair1
1-Newbie
(To:AdamR)

Hallo Adam,

The problem is resolved. The issue was with Netty which was missing some packages in the OSGi environment. After exposing the additional packages, its now working fine.

Regards,

Jishnu

View solution in original post

6 REPLIES 6
AdamR
12-Amethyst
(To:jnair1)

Jishnu,

On the Thingworx platform, is it setup to use SSL?  For the Java SDK you must use a secure connection (wss).

jnair1
1-Newbie
(To:AdamR)

Hallo Adam,

The problem is resolved. The issue was with Netty which was missing some packages in the OSGi environment. After exposing the additional packages, its now working fine.

Regards,

Jishnu

ascotto
1-Newbie
(To:jnair1)

Can you post your example of microservice?

Thanks

jnair1
1-Newbie
(To:ascotto)

Hi,

My program was based on the Thingworx Weather App Example.

You can find it here:

http://www.thingworx.com/academic_content/r-pi-weather-app/

Best Regards,

Jishnu Nair

ascotto
1-Newbie
(To:jnair1)

Thank you for the replay, I'm interested on how you did the bundle for OSGi because I have to add to a service I built.

Your example could save me a lot of time.

Thanks

jnair1
1-Newbie
(To:ascotto)

Hallo Alfredo,

I converted the Thingworx Java SDK to an OSGi bundle using Eclipse.

How to create Eclipse plugins from jars - Tutorial

Regards,

JIshnu

Top Tags