将设备连接到 Worklight 控制台

connect device to worklight console

我已经从 ibm 网站下载了 pushnotification 示例,运行 它在我的 eclipse 中

    06-29 11:12:45.952: W/System.err(8871): org.apache.http.conn.HttpHostConnectException: Connection to http://10.90.33.127:10080 refused
    06-29 11:12:45.952: W/System.err(8871):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
    06-29 11:12:45.952: W/System.err(8871):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    06-29 11:12:45.952: W/System.err(8871):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    06-29 11:12:45.952: W/System.err(8871):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    06-29 11:12:45.952: W/System.err(8871):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    06-29 11:12:45.962: W/System.err(8871):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    06-29 11:12:45.962: W/System.err(8871):     at com.worklight.wlclient.WLRequestSender.run(WLRequestSender.java:47)
    06-29 11:12:45.962: W/System.err(8871):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    06-29 11:12:45.962: W/System.err(8871):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    06-29 11:12:45.962: W/System.err(8871):     at java.lang.Thread.run(Thread.java:856)
    06-29 11:12:45.962: W/System.err(8871): Caused by: java.net.ConnectException: failed to connect to /10.90.33.127 (port 10080) after 10000ms: connect failed: ENETUNREACH (Network is unreachable)
    06-29 11:12:45.962: W/System.err(8871):     at libcore.io.IoBridge.connect(IoBridge.java:114)
    06-29 11:12:45.962: W/System.err(8871):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
    06-29 11:12:45.962: W/System.err(8871):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:460)
    06-29 11:12:45.962: W/System.err(8871):     at java.net.Socket.connect(Socket.java:832)
    06-29 11:12:45.962: W/System.err(8871):     at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
    06-29 11:12:45.962: W/System.err(8871):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
    06-29 11:12:45.962: W/System.err(8871):     ... 9 more
    06-29 11:12:45.962: W/System.err(8871): Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)
    06-29 11:12:45.972: W/System.err(8871):     at libcore.io.Posix.connect(Native Method)
    06-29 11:12:45.972: W/System.err(8871):     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
    06-29 11:12:45.972: W/System.err(8871):     at libcore.io.IoBridge.connectErrno(IoBridge.java:144)
    06-29 11:12:45.972: W/System.err(8871):     at libcore.io.IoBridge.connect(IoBridge.java:112)
    06-29 11:12:45.972: W/System.err(8871):     ... 14 more
    06-29 11:12:46.032: D/wl.certManager(8871): WLCertManager.clearKeystore in WLCertManager.java:258 :: Key store cleared.
    06-29 11:12:46.072: W/PluginManager(8871): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.deleteAllAuthData blocked the main thread for 36ms. Plugin should use CordovaInterface.getThreadPool().
    06-29 11:12:46.082: D/wl.certManager(8871): WLCertManager.clearKeystore in WLCertManager.java:258 :: Key store cleared.
    06-29 11:12:46.162: W/PluginManager(8871): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.getClientInstanceIdHeader blocked the main thread for 87ms. Plugin should use CordovaInterface.getThreadPool().
    06-29 11:12:46.172: W/System.err(8871): org.apache.http.conn.HttpHostConnectException: Connection to http://10.90.33.127:10080 refused
    06-29 11:12:46.172: D/wl.request(8871): WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://10.90.33.127:10080/PushNotifications/authorization/v1/clients/instance
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    06-29 11:12:46.172: W/System.err(8871):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    06-29 11:12:46.172: W/System.err(8871):     at com.worklight.wlclient.WLRequestSender.run(WLRequestSender.java:47)
    06-29 11:12:46.172: W/System.err(8871):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    06-29 11:12:46.182: W/System.err(8871):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    06-29 11:12:46.182: W/System.err(8871):     at java.lang.Thread.run(Thread.java:856)
    06-29 11:12:46.182: W/System.err(8871): Caused by: java.net.ConnectException: failed to connect to /10.90.33.127 (port 10080) after 10000ms: connect failed: ENETUNREACH (Network is unreachable)
    06-29 11:12:46.182: W/System.err(8871):     at libcore.io.IoBridge.connect(IoBridge.java:114)
    06-29 11:12:46.182: W/System.err(8871):     at         java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
    06-29 11:12:46.182: W/System.err(8871):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:460)
    06-29 11:12:46.182: W/System.err(8871):     at java.net.Socket.connect(Socket.java:832)
    06-29 11:12:46.182: W/System.err(8871):     at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
    06-29 11:12:46.182: W/System.err(8871):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
    06-29 11:12:46.182: W/System.err(8871):     ... 9 more
    06-29 11:12:46.182: W/System.err(8871): Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)
    06-29 11:12:46.192: W/System.err(8871):     at libcore.io.Posix.connect(Native Method)
    06-29 11:12:46.192: W/System.err(8871):     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
    06-29 11:12:46.192: W/System.err(8871):     at libcore.io.IoBridge.connectErrno(IoBridge.java:144)
    06-29 11:12:46.192: W/System.err(8871):     at libcore.io.IoBridge.connect(IoBridge.java:112)
    06-29 11:12:46.192: W/System.err(8871):     ... 14 more
    06-29 11:12:46.262: D/wl.certManager(8871): WLCertManager.clearKeystore in WLCertManager.java:258 :: Key store cleared.
    06-29 11:12:46.272: D/NONE(8871): Client registration failed with error: {"responseHeaders":{},"status":500,"responseText":"","errorCode":"UNEXPECTED_ERROR","errorMsg":"Unexpected errorCode occurred. Please try again.","invocationContext":null}
    06-29 11:12:46.332: E/NONE(8871): [/apps/services/api/PushNotifications/android/init] failure. state: 500, response: undefined
    06-29 11:12:46.352: D/NONE(8871): Failed connecting to MobileFirst Server.
    06-29 11:12:46.762: W/PluginManager(8871): THREAD WARNING: exec() call to Notification.confirm blocked the main thread for 403ms. Plugin should use CordovaInterface.getThreadPool().

这是我的 mobilefirst 服务器的详细信息

主机name:10.90.33.127

和我的适配器详细信息

    wlServerProtocol = http
    wlServerHost = 10.90.33.127
    wlServerPort = 10080
    wlServerContext = /PushNotifications/
    wlAppId = PushNotifications

我设备上的错误显示 "failed connecting to the mobilefirst server.Try again later"。

我的 wlclient.properties 是

     wlServerProtocol = http
     wlServerHost = 10.90.33.127
     wlServerPort = 10080
     wlServerContext = /PushNotifications/
     wlAppId = PushNotifications

如果您转到 10.90.33.127:10080/worklightconsole,您真的会在桌面浏览器中看到控制台吗?

如果您在移动设备上执行相同的操作,是否还会看到控制台?

听起来您的移动设备未连接到与您的服务器相同的网络。如果您在本地环境中进行测试,请确保您的移动设备连接到与计算机相同的 wifi 网络。