我正在使用IBM Worklight 6.1并尝试在生产服务器上进行部署。 在我的开发服务器上,一切正常,但一旦我部署,然后尝试在浏览器上预览应用程序,我有一个循环的js错误说:
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
Request [/MyApp/apps/services/api/MyApp/common/init] worklight.js:4558
POST http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/common/init 401 (Unauthorized) worklight.js:1081
编辑: 测试时,我有以下日志:
2014-05-19 08:00:44.318 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.336 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.339 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.348 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.350 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
2014-05-19 08:00:44.356 MyApp[33533:a0b] DeviceAuthManager:getWorklightUniqueDeviceId --> returning UUID from the keychain
2014-05-19 08:00:44.360 MyApp[33533:a0b] DEBUG: Request [http://172.16.1.2:9080/MyApp/apps/services/api/MyApp/iphone/init]
(我是从我的控制台http://172.16.1.2:9080/MyApp/console
部署的,我现在正在将我的本地网络IP用于测试一切正常)
我在服务器日志中找不到任何信息
答案 0 :(得分:1)
我不确定为什么你会收到 3次这个日志行(这听起来像是一个问题),但这个401本身并不是一个错误。
当应用程序向服务器发送init
请求时(通过使用connectOnStartup:true
或WL.Client.connect
,接收单个 401的预期行为响应。
来自“Understanding predefined Worklight authentication realms and security tests”:
当新会话启动时,第一个请求Worklight 服务器将获得包含WL-Instance-Id令牌的HTTP 401响应。 Worklight框架将提取此标记并将其用作标题 所有后续请求。
我会仔细检查你的应用程序,你不使用 {/ 1>}和connectOnStartup
;它是 - 或者。另外,请检查您是否按顺序多次使用它。