2 Replies Latest reply on Sep 18, 2016 10:45 PM by lvincent RSS
    lvincent Newbie

    Connect Error use ProtocolAdapterSDK

    I follow the protocol-adapter-user-guide.pdf , first i create an applicationKey like this:

    keyId: da703fb6-a5e6-4a6f-b79a-641f8099c89f

    and in the JavaCode , i fill the config.json like this:

    "rows": [{

          "thingWorxServerUseSSL": false,

          "thingWorxServerAPIKey": "da703fb6-a5e6-4a6f-b79a-641f8099c89f",

          "thingWorxServerTimeout": 60000,

          "thingWorxServer": "120.25.75.77",

          "thingWorxServerPort": 8080

     

        }]

    and

    "rows": [{

          "socketPort": 11088,

          "connectionServerThingName": "myConnectionTestServer"

     

        }]

    or so, in my linux-server, i allow port 11088 in iptable;

     

    but when i run the "java -jar ProtocolAdapterSDK.jar", i got the Error in my Thingworx Monitor bellow

    Error [authenticating connection], Server websocket will be closed. cause: invalid AppKey SecurityClaim provided

     

    when run the java jar, it would not connect to the server, the log like this:

    15:13:11.925 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available

    15:13:11.927 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false

    15:13:11.933 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable

    15:13:11.934 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes.  Please check the configuration for better performance.

    15:13:11.934 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)

    15:13:11.934 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)

    15:13:11.934 [Thread-0] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false

    15:13:11.968 [Thread-0] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false

    15:13:11.968 [Thread-0] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 1

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 1

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216

    15:13:12.010 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512

    15:13:12.011 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256

    15:13:12.011 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64

    15:13:12.011 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768

    15:13:12.011 [Thread-0] DEBUG i.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192

    15:13:12.028 [Thread-0] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - Initializing CommunicationEndpoint Connection Monitor...

    15:13:12.034 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.m.CommunicationEndpointMonitorTask - CommunicationEndpoint Monitor - checking for disconnected endpoints

    15:13:12.035 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect...

    15:13:12.035 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.ClientCommunicationEndpoint - Clearing endpoint authentication data [id: 0]

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

    15:13:12.100 [Client-EndpointMonitor-1] DEBUG i.n.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x9a4c82fc17e07926 (took 4 ms)

    15:13:12.150 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: unpooled

    15:13:12.155 [Client-EndpointMonitor-1] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536

    15:13:12.297 [NettyClient-NIO-1] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetectionLevel: simple

    15:13:12.335 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.ThingworxClientConnectionHandler - WebSocket Channel is connected [is open: true]

    15:13:12.341 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocketClientHandshaker13 - WebSocket version 13 client handshake key: KL2OOjzWUYVcCyHoNrj47Q==, expected response: FpRb4jPP3qs/bihgiMSeerboR/U=

    15:13:12.357 [NettyClient-NIO-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144

    15:13:12.448 [NettyClient-NIO-1] DEBUG c.t.c.c.c.n.ThingworxClientConnectionHandler - [ClientHandler: 1656749904] Client websocket handshake is complete

    15:13:12.452 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.ClientCommunicationEndpoint - Preparing new Connection Authentication Request: DispatchingClientEndpoint [id: 0, isConnected: false, open connections: 0, max connections: 1]

    15:13:12.454 [Client-EndpointMonitor-1] DEBUG c.t.c.c.e.CommunicationEndpoint - Sending connection authentication message, waiting for response [sync key: 1, message: AuthRequestMessage [requestId: 1, endpointId: -1, sessionId: -1, method: AUTHREQUEST]]

    15:13:12.462 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=2 length=24

    15:13:12.464 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=2

    15:13:12.464 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=106

    15:13:12.464 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=8

    15:13:12.464 [NettyClient-NIO-1] DEBUG i.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=69

    15:13:12.514 [Client-EndpointMonitor-1] ERROR c.t.c.c.e.ClientCommunicationEndpoint - Refilling connections on [endpoint 0, uri: ws://localhost:8080/Thingworx/WS] failed : Connection authentication/registration FAILED [code: STATUS_UNAUTHORIZED, reason: Error [context: authenticating connection][cause: invalid AppKey SecurityClaim provided]]

    15:13:12.514 [Client-EndpointMonitor-1] INFO  c.t.c.c.e.m.CommunicationEndpointMonitorTask - Endpoint reconnection was unsuccessful [name: EP_0, id: 0]

    15:13:12.515 [NettyClient-NIO-1] DEBUG c.t.c.c.e.DispatchingClientEndpoint - RESPONSE received [endpoint id: 0, duration: 58] ResponseMessage [requestId: 1, endpointId: 152, sessionId: -1, code: STATUS_UNAUTHORIZED, multipart: false, packet #: 0, total packets: 0]

     

    15:13:12.772 [main] INFO  c.t.c.c.t.f.FileTransferVirtualThing - Creating new MegaTrackerConnectionServerThing [name: SuhaiConnectionServer, logs: /root/., stagingPath: null]

     

    Please who can help me ????