IBM MobileFirst 7.0,脱机工作示例应用程序不工作

Posted

技术标签:

【中文标题】IBM MobileFirst 7.0,脱机工作示例应用程序不工作【英文标题】:IBM MobileFirst 7.0, Working offline sample application not working 【发布时间】:2015-03-26 11:43:49 【问题描述】:

环境: 1. Windows 7 和 2.IBM MobileFirst Platform Studio 7.0

Getting Started Modules 中的 IBM MobileFirst Platform 7.0 的示例脱机工作应用程序导入并使用以下过程进行了测试。

1. Set heartbeat to 5 seconds
2. Background application behavior can be seen using web debuggers
3. Shut down MobileFirst Server
4. In a few seconds heartbeat should fail, and disconnectDetected function should be invoked
5. Start up MobileFirst Server
6. In a few seconds heartbeat should succeed, and connectDetected function should be invoked

但是disconnectDetectedconnectDetected函数分别在服务器停止和启动时没有触发。

function disconnectDetected()
    var output = new Date() + "<hr />disconnectDetected";
    $('#info').html(output);


function connectDetected()
    var output = new Date() + "<hr />connectDetected";
    $('#info').html(output);

日志如下。

http://localhost:10080/WorkingOffline/apps/services/preview/WorkingOffline/common/0/default/js/test.js Failed to load resource: the server responded with a status of 404 (Not Found)
wljq.js:8654 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
worklight.js:5127 wlclient init started
worklight.js:5127 before: initOptions.onSuccess
worklight.js:5127 after: initOptions.onSuccess
worklight.js:5127 wlclient init success
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 401 (Unauthorized)
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3794 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.handleResendOrSendPostAnswersworklight.js:3783 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.removeExpectedAnswerworklight.js:9432 challengeHandler.submitChallengeAnswerworklight.js:10193 wl_antiXSRFChallengeHandler.handleChallengeworklight.js:9328 AbstractChallengeHandler.startChallengeHandlingworklight.js:9251 executeChallengeworklight.js:9153 checkResponseForChallengesworklight.js:3598 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlFailureworklight.js:956 (anonymous function)worklight.js:1178 window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyStateworklight.js:1111 window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChangeworklight.js:956 (anonymous function)
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application is now  online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success: 
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:5127 Application is now  online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success: 
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat net::ERR_CONNECTION_REFUSED
worklight.js:5127 Application is now offline.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] Host is not responsive.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 404 (Not Found)
worklight.js:5127 Application is now  online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 404, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now  online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now  online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 503 (Service Unavailable)
worklight.js:5127 Application is now  online.
worklight.js:5127 [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] failure. state: 503, response: The server was unable to process the request from the application. Please try again later.
worklight.js:5127 Failed to send heartbeat
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:1097 POST http://localhost:10080/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat 401 (Unauthorized)
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3794 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.handleResendOrSendPostAnswersworklight.js:3783 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.removeExpectedAnswerworklight.js:9432 challengeHandler.submitChallengeAnswerworklight.js:10193 wl_antiXSRFChallengeHandler.handleChallengeworklight.js:9328 AbstractChallengeHandler.startChallengeHandlingworklight.js:9251 executeChallengeworklight.js:9153 checkResponseForChallengesworklight.js:3598 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlFailureworklight.js:956 (anonymous function)worklight.js:1178 window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyStateworklight.js:1111 window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChangeworklight.js:956 (anonymous function)
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application is now  online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success: 
worklight.js:5127 Heartbeat sent successfully
worklight.js:5127 Request [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat]
worklight.js:5127 Application details header: "applicationDetails":"platformVersion":"7.0.0.0","nativeVersion":""worklight.js:5127 WL.Logger.__logworklight.js:5511 PUBLIC_API.(anonymous function)worklight.js:3330 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.createRequestHeadersworklight.js:3388 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3302 window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:524 klassworklight.js:7249 sendHeartBeatworklight.js:893 onTimerEventworklight.js:956 (anonymous function)
worklight.js:5127 Application is now  online.
worklight.js:5127 response [/WorkingOffline/apps/services/api/WorkingOffline/common/heartbeat] success: 
worklight.js:5127 Heartbeat sent successfully

但是,从 IBM MobileFirst Platform 6.3 Sample Working Offline 应用程序开始,可以在 IBM MobileFirst Studio 6.3 中完美运行

【问题讨论】:

【参考方案1】:

事实上,这似乎是一个缺陷 - 目前正在调试中。 似乎没有解决方法。

如果需要修复,您需要打开 PMR(IBM 支持票证)。

【讨论】:

修复中的任何 ETA。我也收到此错误 [/worklight/apps/services/api/myApp/common/query] 失败。状态:503,响应:服务器无法处理来自应用程序的请求。请稍后再试。 (worklight.js,第 1161 行)。我正在使用 5.0.6。我用 6.3 试了一下,得到了同样的错误 已经修好了。登录 IBM 修复中心并获取最新的 iFix。如果您从 eclipse 市场安装了插件,请尝试检查 eclipse 中的更新。

以上是关于IBM MobileFirst 7.0,脱机工作示例应用程序不工作的主要内容,如果未能解决你的问题,请参考以下文章

IBM MobileFirst 项目迁移 6.2.0.1 到 7.0

IBM MobileFirst 7.0 - 适配器调用

IBM MobileFirst 7.0 - 我们如何生成 .ipa 文件?

我们如何跟踪从 IBM MobileFirst 7.0 发送到 Apple APNS 服务器的推送通知?

无法构建 IBM MobileFirst Platform 7.0 java 适配器

iFix 之后的 IBM MobileFirst 7.0 Windows8 App 连接问题