Maximo Anywhere Not Able To login - ibm-mobilefirst

I have Maximo Anywhere installed on WebSphere 8.5.5.3 and Maximo installed in Weblogic
i am not able to login to anywhere apps
i tried to debug it from chrome console i found its stuck on loop as the below
> worklight.js:4675 Request [login]
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] true - authStatus
Logger.js:163 [TRACE] [ServerAuthenticationProvider] User test successfully authentication against realm "CustomAuthenticationRealm"
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":true,"userId":"test","attributes":{"Cookie":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=\/","AuthenticationDate":"Wed Jul 08 03:07:48 GST 2015"},"isUserAuthenticated":1,"responseID":"149252","displayName":null}*/
Logger.js:163 [TRACE] User test authenticated successfully on server
Logger.js:163 [TRACE] [COMM] Previous "userInfo" resource data request resolved.
Logger.js:163 [TRACE] [COMM] Getting data from adapter if connectivity is available.
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 1ms
Logger.js:163 [TRACE] [COMM] Connectivity is available
Logger.js:163 [TRACE] [COMM] Requesting data for adapter
Logger.js:151 [COMM] resourceUrl: http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier
Logger.js:163 [TRACE] Invoking adapter with these parameters: {"adapter":"OSLCGenericAdapter","procedure":"query","parameters":[{"url":"http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier","sessionid":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=/","langcode":"en-US"}],"timeout":360000}
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http:\/\/192.168.1.31:7001\/maximo\/oslc\/error\/messages\/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149253"}*/
worklight.js:4675 Procedure invocation error. [object Object]WL.Logger.__log # worklight.js:4675PUBLIC_API.(anonymous function) # worklight.js:4860onInvokeProcedureSuccess # worklight.js:7353window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onSuccess # worklight.js:3240window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlSuccess # worklight.js:3212(anonymous function) # worklight.js:949window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyState # worklight.js:1158window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChange # worklight.js:1096(anonymous function) # worklight.js:949
Logger.js:163 [TRACE] UserAuthenticationManager.invokeAdapterSecurely: onFailure{"status":200,"invocationContext":null,"errorCode":"PROCEDURE_ERROR","errorMsg":"Procedure invocation error. [object Object]","invocationResult":{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http://192.168.1.31:7001/maximo/oslc/error/messages/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149253"}}
Logger.js:163 [TRACE] Session for user test expired
Logger.js:163 [TRACE] Reauthenticating
Logger.js:163 [TRACE] Authenticating user test against realm CustomAuthenticationRealm
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 0ms
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
worklight.js:4675 Request [login]
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] true - authStatus
Logger.js:163 [TRACE] [ServerAuthenticationProvider] User test successfully authentication against realm "CustomAuthenticationRealm"
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":true,"userId":"test","attributes":{"Cookie":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=\/","AuthenticationDate":"Wed Jul 08 03:07:48 GST 2015"},"isUserAuthenticated":1,"responseID":"149254","displayName":null}*/
Logger.js:163 [TRACE] User test authenticated successfully on server
Logger.js:163 [TRACE] [COMM] Previous "userInfo" resource data request resolved.
Logger.js:163 [TRACE] [COMM] Getting data from adapter if connectivity is available.
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 0ms
Logger.js:163 [TRACE] [COMM] Connectivity is available
Logger.js:163 [TRACE] [COMM] Requesting data for adapter
Logger.js:151 [COMM] resourceUrl: http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier
Logger.js:163 [TRACE] Invoking adapter with these parameters: {"adapter":"OSLCGenericAdapter","procedure":"query","parameters":[{"url":"http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier","sessionid":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=/","langcode":"en-US"}],"timeout":360000}
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http:\/\/192.168.1.31:7001\/maximo\/oslc\/error\/messages\/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149255"}*/
worklight.js:4675 Procedure invocation error. [object Object]WL.Logger.__log # worklight.js:4675PUBLIC_API.(anonymous function) # worklight.js:4860onInvokeProcedureSuccess # worklight.js:7353window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onSuccess # worklight.js:3240window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlSuccess # worklight.js:3212(anonymous function) # worklight.js:949window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyState # worklight.js:1158window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChange # worklight.js:1096(anonymous function) # worklight.js:949
Logger.js:163 [TRACE] UserAuthenticationManager.invokeAdapterSecurely: onFailure{"status":200,"invocationContext":null,"errorCode":"PROCEDURE_ERROR","errorMsg":"Procedure invocation error. [object Object]","invocationResult":{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http://192.168.1.31:7001/maximo/oslc/error/messages/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149255"}}
Logger.js:163 [TRACE] Session for user test expired
Logger.js:163 [TRACE] Reauthenticating
Logger.js:163 [TRACE] Authenticating user test against realm CustomAuthenticationRealm
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 0ms
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
worklight.js:4675 Request [login]
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] true - authStatus
Logger.js:163 [TRACE] [ServerAuthenticationProvider] User test successfully authentication against realm "CustomAuthenticationRealm"
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":true,"userId":"test","attributes":{"Cookie":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=\/","AuthenticationDate":"Wed Jul 08 03:07:48 GST 2015"},"isUserAuthenticated":1,"responseID":"149256","displayName":null}*/
Logger.js:163 [TRACE] User test authenticated successfully on server
Logger.js:163 [TRACE] [COMM] Previous "userInfo" resource data request resolved.
Logger.js:163 [TRACE] [COMM] Getting data from adapter if connectivity is available.
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 1ms
Logger.js:163 [TRACE] [COMM] Connectivity is available
Logger.js:163 [TRACE] [COMM] Requesting data for adapter
Logger.js:151 [COMM] resourceUrl: http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier
Logger.js:163 [TRACE] Invoking adapter with these parameters: {"adapter":"OSLCGenericAdapter","procedure":"query","parameters":[{"url":"http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser?savedQuery=currentUser&…Bspi%3Agroupname%7D&oslc.pageSize=300&oslc.orderBy=%2Bdcterms%3Aidentifier","sessionid":"JSESSIONID=0000NpUyrxPJPTCpeahWtAKZ-xr:-1; Path=/","langcode":"en-US"}],"timeout":360000}
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http:\/\/192.168.1.31:7001\/maximo\/oslc\/error\/messages\/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149257"}*/
worklight.js:4675 Procedure invocation error. [object Object]WL.Logger.__log # worklight.js:4675PUBLIC_API.(anonymous function) # worklight.js:4860onInvokeProcedureSuccess # worklight.js:7353window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onSuccess # worklight.js:3240window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlSuccess # worklight.js:3212(anonymous function) # worklight.js:949window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyState # worklight.js:1158window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChange # worklight.js:1096(anonymous function) # worklight.js:949
Logger.js:163 [TRACE] UserAuthenticationManager.invokeAdapterSecurely: onFailure{"status":200,"invocationContext":null,"errorCode":"PROCEDURE_ERROR","errorMsg":"Procedure invocation error. [object Object]","invocationResult":{"isSuccessful":false,"errors":[{"oslc:extendedError":{"oslc:moreInfo":{"rdf:resource":"http://192.168.1.31:7001/maximo/oslc/error/messages/BMXAA0021E04"}},"oslc:message":"BMXAA0021E04 - User name and password combination are not valid. Try again.","oslc:statusCode":"401","spi:reasonCode":"BMXAA0021E04"}],"responseID":"149257"}}
Logger.js:163 [TRACE] Session for user test expired
Logger.js:163 [TRACE] Reauthenticating
Logger.js:163 [TRACE] Authenticating user test against realm CustomAuthenticationRealm
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 0ms
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
*i tried to call the OSLC Link direct from Maximo its working fine.
*i tried to run the application from eclipse and using Librity server it working fine .
I Restarted the Server where Work-light installed the exception changed to
Authentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:303:23)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
at null.<anonymous> (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/ui/control/UserInterface.js:757:47)
at HTMLButtonElement.e.hitch (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:34:484)
at Function.g.emit (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:106:485)
at declare.fire (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojox/gesture/Base.js:306:7)"l # dojo.js:59h # dojo.js:59k.around.advice # dojo.js:95e.(anonymous function).k # dojo.js:94m # dojo.js:89q.reject # dojo.js:92a # dojo.js:90g # dojo.js:89o.then.b.then # dojo.js:92classBody._activateCollections # PersistenceManager.js:303classBody.activateCollectionsOrFail # PersistenceManager.js:284lang.mixin._localAuthentication # UserAuthenticationManager.js:303lang.mixin.login # UserAuthenticationManager.js:133declare.loginClickHandler # LoginHandler.js:72(anonymous function) # UserInterface.js:757e.hitch # dojo.js:34g.emit # dojo.js:106declare.fire # Base.js:306declare.release # tap.js:104declare._process # Base.js:273e._hitchArgs # dojo.js:34
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: true
Startup.js:44 Hiding the "Loading..." message in 8 seconds
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: false
Startup.js:44 Hiding the "Loading..." message in 8 seconds
dojo.js:59 Object {name: undefined, messageKey: undefined, params: Array[0], stack: "undefined? at http://localhost:9084/worklight/a…fault/js/platform/handlers/LoginHandler.js:72:47)"} "undefined
at http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:308:23
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:320)
at o.then.b.then [as then] (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:198)
at classBody._activateCollections (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:303:4)
at classBody.activateCollectionsOrFail (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:284:16)
at Object.lang.mixin._localAuthentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:303:23)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
----------------------------------------
rejected at a (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:90:226)
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:493)
at o.then.b.then [as then] (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:198)
at Object.lang.mixin._localAuthentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:304:4)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
at null.<anonymous> (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/ui/control/UserInterface.js:757:47)
at HTMLButtonElement.e.hitch (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:34:484)
at Function.g.emit (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:106:485)
at declare.fire (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojox/gesture/Base.js:306:7)
----------------------------------------
Error
at o.then.b.then [as then] (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:143)
at Object.lang.mixin._localAuthentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:304:4)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
at null.<anonymous> (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/ui/control/UserInterface.js:757:47)
at HTMLButtonElement.e.hitch (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:34:484)
at Function.g.emit (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:106:485)
at declare.fire (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojox/gesture/Base.js:306:7)
at declare.release (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojox/gesture/tap.js:104:10)
at declare._process (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojox/gesture/Base.js:273:15)"l # dojo.js:59h # dojo.js:59k.around.advice # dojo.js:95e.(anonymous function).k # dojo.js:94m # dojo.js:89q.reject # dojo.js:92a # dojo.js:90g # dojo.js:89o.then.b.then # dojo.js:92lang.mixin._localAuthentication # UserAuthenticationManager.js:304lang.mixin.login # UserAuthenticationManager.js:133declare.loginClickHandler # LoginHandler.js:72(anonymous function) # UserInterface.js:757e.hitch # dojo.js:34g.emit # dojo.js:106declare.fire # Base.js:306declare.release # tap.js:104declare._process # Base.js:273e._hitchArgs # dojo.js:34
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: false
Startup.js:44 Hiding the "Loading..." message in 8 seconds
dojo.js:59 Object {name: undefined, messageKey: undefined, params: Array[0], stack: "undefined? at http://localhost:9084/worklight/a…fault/js/platform/handlers/LoginHandler.js:72:47)"} "undefined
at http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:308:23
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:320)
at o.then.b.then [as then] (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:198)
at classBody._activateCollections (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:303:4)
at classBody.activateCollectionsOrFail (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:284:16)
at Object.lang.mixin._localAuthentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:303:23)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
----------------------------------------
rejected at a (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:90:226)
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:479)
at o.then.b.then [as then] (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:198)
at classBody._activateCollections (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:303:4)
at classBody.activateCollectionsOrFail (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/store/PersistenceManager.js:284:16)
at Object.lang.mixin._localAuthentication (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:303:23)
at Object.lang.mixin.login (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:133:10)
at declare.loginClickHandler (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/handlers/LoginHandler.js:72:47)
at null.<anonymous> (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/ui/control/UserInterface.js:757:47)
at HTMLButtonElement.e.hitch (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:34:484)
----------------------------------------
undefined"l # dojo.js:59h # dojo.js:59k.around.advice # dojo.js:95e.(anonymous function).k # dojo.js:94g # dojo.js:90o.then.b.then # dojo.js:92lang.mixin._localAuthentication # UserAuthenticationManager.js:304lang.mixin.login # UserAuthenticationManager.js:133declare.loginClickHandler # LoginHandler.js:72(anonymous function) # UserInterface.js:757e.hitch # dojo.js:34g.emit # dojo.js:106declare.fire # Base.js:306declare.release # tap.js:104declare._process # Base.js:273e._hitchArgs # dojo.js:34
Logger.js:163 [TRACE] Authenticating user test1 against realm CustomAuthenticationRealm
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 0ms
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
Logger.js:231 [TIMER] [COMM] Fetching simulator for connectivity: 1ms
worklight.js:4675 Request [/worklight/apps/services/api/WorkExecution/common/query]
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: true
Startup.js:44 Hiding the "Loading..." message in 8 seconds
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] false
worklight.js:4675 response [/worklight/apps/services/api/WorkExecution/common/query] success: /*-secure-
{"properties":{"si.auth.type":"maximo"},"isSuccessful":true,"responseID":"7"}*/
Logger.js:163 [TRACE] [COMM] Successfully returned properties: {"si.auth.type":"maximo"}
worklight.js:4675 Request [login]
Logger.js:163 [TRACE] ServerAuthenticationProvider.login
Logger.js:163 [TRACE] [CustomChallangeHandler.isCustomResponse] true - authStatus
Logger.js:151 [_realmAuthentication] Unable to authenticate user test1 on server
Logger.js:151 Loading message showed by application = true
Logger.js:151 Cancel processing requested
Logger.js:163 [TRACE] Closing local storage
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: true
Startup.js:44 Hiding the "Loading..." message in 8 seconds
Startup.js:42 === Global promise rejection handling ===
Startup.js:43 === handled: false
Startup.js:44 Hiding the "Loading..." message in 8 seconds
dojo.js:59 Object {oslcError: "null oslcError", errorMsg: "Your user name and password could not be validated. Connect to the server and try again."} "
----------------------------------------
rejected at Object.<anonymous> (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/js/platform/auth/UserAuthenticationManager.js:523:17)
at e.hitch (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:34:484)
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:320)
at m (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:246)
at q.reject (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:92:33)
at a (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:90:226)
at g (http://localhost:9084/worklight/apps/services/preview/WorkExecution/common/0/default/dojo/dojo.js:89:493)
at m

So you said you restarted the server worklight is installed on. The first thing i would ask then is the war file that you deployed to that server, when it was built, was it pointing to a different Maximo than what your adapter currently has?
If it worked in the liberty server, I would say to update the war file that your worklight server is using, there may be a difference in what it is pointing.
This would involve updating your build.properties'
worklight.server.* properties, then rebuild the app, and then redeploy the war file that you will have in your MaximoAnywhere/bin directory

You have a authentication/login error based on "errorMsg: "Your user name and password could not be validated. Connect to the server and try again." and "oslc:statusCode":"401" . I don't know much about Anywhere. Can you explain how the authentication to the backend (OSLC oto Maximo) is hapenning ? What is the security test declared in for "OSLCGenericAdapter" procedure:"query",? It seems you are doing a request to "http://192.168.1.31:7001/maximo/oslc/os/oslcmaxuser" maybe this server is not available ? Are you using some invalid username/pass ?

Related

enabling SSL for Hyperledger Fabric couchdb

I want to use couchDB(V. 2.3.1) with SSL enabled, so I added [ssl] part to /opt/couchdb/etc/local.d/docker.ini file as shown below:
[ssl]
port = 6984
enable = true
cert_file = /etc/hyperledger/fabric/tls/server.crt
key_file = /etc/hyperledger/fabric/tls/server.key
cacert_file = /etc/hyperledger/fabric/tls/ca.crt
[daemons]
httpsd = {couch_httpd, start_link, [https]}
[admins]
Admin = ...
[couchdb]
uuid = ...
but i can't access the webUI with https! having this error:
This site can’t provide a secure connection
"IP" uses an unsupported protocol.
ERR_SSL_VERSION_OR_CIPHER_MISMATCH
Unsupported protocol
The client and server don't support a common SSL protocol version or cipher suite.
this is the logs:
[error] 2020-05-17T06:52:18.046389Z nonode#nohost <0.19077.3> -------- SSL: hello: tls_handshake.erl:127:Fatal error: handshake failure - malformed_handshake_data
[error] 2020-05-17T06:52:18.046426Z nonode#nohost <0.18899.3> -------- application: mochiweb, "Accept failed error", "{error,{tls_alert,\"handshake failure\"}}"
[error] 2020-05-17T06:52:18.046508Z nonode#nohost <0.18899.3> -------- CRASH REPORT Process (<0.18899.3>) with 0 neighbors exited with reason: {error,accept_failed} at mochiweb_acceptor:init/4(line:75) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {mochiweb_acceptor,init,['Argument__1','Argument__2',...]}, ancestors: [https,couch_secondary_services,couch_sup,<0.202.0>], messages: [], links: [<0.253.0>], dictionary: [], trap_exit: false, status: running, heap_size: 1598, stack_size: 27, reductions: 954
can somebody please help me?
I found the solution and wrote a post about it:
https://medium.com/#pouyashojaei85/enabling-ssl-for-docker-couchdb-container-127388eca1a8

No response from Ratchet websocket using Apache reverse proxy

I am trying to implement WyriHaximus/Ratchet plugin for CakePHP 3.
My cakephp app is running on eg: blah.myhost.com which has a ssl certificate enabled.
I've setup my app.php for the plugins configuration like this
'WyriHaximus' => [
'Ratchet' => [
'internal' => [
'address' => '0.0.0.0',
'port' => 8888,
],
'external' => [
'hostname' => 'blah.myhost.com',
'port' => 8888,
],
'defaults' => [
'retry_delay_growth' => 0.25,
],
'realm_salt' => 'y[Pw3^o`hLxn`sZkZgtIZ={?B:!Q.8',
'realm_auth_key_salt' => 'EEA~D`o:ZIIm=hR0bcD$3D+((ti:V;',
'realms' => [
'realm1' => [], // Always has to be an array
'secure' => [
'auth' => true,
'auth_key' => '5J^e=7ec5g!0j#I4.t%"0Ih2)qp]I)',
'max_retries' => 13,
],
],
],
]
and I can run the web socket server with the instructions here which runs fine and outputs this
2019-06-04T18:38:02.6496330 debug [Thruway\Peer\Router 5123] New router created
2019-06-04T18:38:02.6531680 info [Thruway\Authentication\AuthenticationManager 5123] New client created
2019-06-04T18:38:02.6550820 info [WyriHaximus\Ratchet\Websocket\InternalClient 5123] New client created
2019-06-04T18:38:02.6554090 info [WyriHaximus\Ratchet\Websocket\InternalClient 5123] New client created
2019-06-04T18:38:02.6560020 info [WyriHaximus\Ratchet\Security\AuthorizationManager 5123] New client created
2019-06-04T18:38:02.6614470 info [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] New client created
2019-06-04T18:38:02.6619220 info [Thruway\Peer\Router 5123] Starting router
2019-06-04T18:38:02.6685010 info [Thruway\RealmManager 5123] Got prehello...
2019-06-04T18:38:02.6687590 debug [Thruway\RealmManager 5123] Creating new realm 'thruway.auth'
2019-06-04T18:38:02.6719630 debug [Thruway\RealmManager 5123] Adding realm 'thruway.auth'
2019-06-04T18:38:02.6763120 debug [Thruway\Authentication\AuthenticationManager 5123] Client onMessage: [Thruway\Message\WelcomeMessage]
2019-06-04T18:38:02.6765620 info [Thruway\Authentication\AuthenticationManager 5123] We have been welcomed...
2019-06-04T18:38:02.6794560 debug [Thruway\Authentication\AuthenticationManager 5123] Client onMessage: [Thruway\Message\RegisteredMessage]
2019-06-04T18:38:02.6797150 info [Thruway\Role\Callee 5123] Setting registration_id for thruway.auth.registermethod (0)
2019-06-04T18:38:02.6814840 info [Thruway\RealmManager 5123] Got prehello...
2019-06-04T18:38:02.6817350 debug [Thruway\RealmManager 5123] Creating new realm 'realm1'
2019-06-04T18:38:02.6819770 debug [Thruway\RealmManager 5123] Adding realm 'realm1'
2019-06-04T18:38:02.6825430 debug [WyriHaximus\Ratchet\Websocket\InternalClient 5123] Client onMessage: [Thruway\Message\WelcomeMessage]
2019-06-04T18:38:02.6827820 info [WyriHaximus\Ratchet\Websocket\InternalClient 5123] We have been welcomed...
2019-06-04T18:38:02.6835090 info [Thruway\RealmManager 5123] Got prehello...
2019-06-04T18:38:02.6837500 debug [Thruway\RealmManager 5123] Creating new realm 'secure'
2019-06-04T18:38:02.6839950 debug [Thruway\RealmManager 5123] Adding realm 'secure'
2019-06-04T18:38:02.6845380 debug [WyriHaximus\Ratchet\Websocket\InternalClient 5123] Client onMessage: [Thruway\Message\WelcomeMessage]
2019-06-04T18:38:02.6847750 info [WyriHaximus\Ratchet\Websocket\InternalClient 5123] We have been welcomed...
2019-06-04T18:38:02.6852190 info [Thruway\RealmManager 5123] Got prehello...
2019-06-04T18:38:02.6856620 debug [WyriHaximus\Ratchet\Security\AuthorizationManager 5123] Client onMessage: [Thruway\Message\WelcomeMessage]
2019-06-04T18:38:02.6858990 info [WyriHaximus\Ratchet\Security\AuthorizationManager 5123] We have been welcomed...
2019-06-04T18:38:02.6875670 info [Thruway\Transport\RatchetTransportProvider 5123] Websocket listening on 0.0.0.0:8888
2019-06-04T18:38:02.6888710 info [Thruway\RealmManager 5123] Got prehello...
2019-06-04T18:38:02.6893150 debug [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] Client onMessage: [Thruway\Message\WelcomeMessage]
2019-06-04T18:38:02.6895540 info [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] We have been welcomed...
2019-06-04T18:38:02.6899420 debug [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] Client onMessage: [Thruway\Message\RegisteredMessage]
2019-06-04T18:38:02.6901870 info [Thruway\Role\Callee 5123] Setting registration_id for thruway.auth.jwt.onhello (0)
2019-06-04T18:38:02.6906900 debug [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] Client onMessage: [Thruway\Message\RegisteredMessage]
2019-06-04T18:38:02.6909310 info [Thruway\Role\Callee 5123] Setting registration_id for thruway.auth.jwt.onauthenticate (1)
2019-06-04T18:38:02.6928160 debug [Thruway\Authentication\AuthenticationManager 5123] Client onMessage: [Thruway\Message\InvocationMessage]
2019-06-04T18:38:02.6937120 debug [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] Client onMessage: [Thruway\Message\ResultMessage]
2019-06-04T18:38:02.6942790 debug [WyriHaximus\Ratchet\Security\JWTAuthProvider 5123] Authentication Method Registration Successful: jwt
my ufw status outputs this
:~# ufw status | grep 8888
8888/tcp ALLOW Anywhere
8888/tcp (v6) ALLOW Anywhere (v6)
my Apache default-ssl.conf for the ProxyPass part looks like this
SSLProxyEngine On
ProxyRequests Off
ProxyPass "/wss2/" "wss://blah.myhost.com:8888/"
This is the code I'm running in the browser to attempt to connect to the websocket.
var conn = new WebSocket('wss://blah.myhost.com/wss2/');
conn.onopen = function(e) {
console.log("Connection established!");
};
conn.onmessage = function(e) {
console.log(e.data);
};
I get this message in the apache access.log but no error
04/Jun/2019:17:47:56 +1200] "GET /wss2/ HTTP/1.1" 500 4577 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
The response I get after a long time in the browser is this
WebSocket connection to 'wss://blah.myhost.com/wss2/' failed: WebSocket opening handshake timed out
Other methods I've tried include
Using Rewrite engine in my Apache default-ssl.conf
SSLProxyEngine On
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule ^/ wss://blah.myhost.com:8888/ [P,L]
Using this to connect
var conn = new WebSocket('wss://blah.myhost.com/');
This gives the exact same response
Also when I change the app.php config to use the external ip 0.0.0.0 to make the server listen on 0.0.0.0:8888 and then Rewrite to wss://0.0.0.0:8888/ I get this error on apache error.log when trying to connect.
[Tue Jun 04 18:27:04.089837 2019] [proxy:error] [pid 5648] (20014)Internal error (specific information not available): [client ^^^.^^^.^^^.^:^^^^] AH01084: pass request body failed to 0.0.0.0:8888 (0.0.0.0)
[Tue Jun 04 18:27:04.090047 2019] [proxy:error] [pid 5648] [client ^^^.^^^.^^^.^:^^^^] AH00898: Error during SSL Handshake with remote server returned by /
I'm not sure what I'm doing wrong; perhaps my config in app.php is wrong, or I'm missing some vital steps.
Solved by using a autobahn to connect to the Websocket instead of the code I provided. Also I changed my external IP in my app.php to 0.0.0.0 and the Proxypass ip to 0.0.0.0 instead of my domain name.

IBM Worklight 5.0.6 - /init vs WL.Client.connect() call

I have a simple test application where I am deciding how to handle the server connection via WL.Client.connect().
During the application startup no authentication process takes place. Just the standard initialization with initOptions.js (connectOnStartup:false) and then the wlCommonInit() invocation where I have placed the call to the server (WL.Client.connect()) with proper success/failure handlers.
When I test the app with the Mobile Browser Simulator (e.g.: Android environment), I got the following stack trace from the browser console:
WL.Client.init() passed! wlgap.android.js:1538
wlclient init started wlgap.android.js:1538
before: app init onSuccess wlgap.android.js:1538
Request [/apps/services/api/UnisTestAdapters/android/init] wlgap.android.js:1538
inside wlCommonInit wlgap.android.js:1538
after: app init onSuccess wlgap.android.js:1538
wlclient init success wlgap.android.js:1538
wlclient init started wlgap.android.js:1538
before: app init onSuccess wlgap.android.js:1538
Cannot invoke WL.Client.connect while it is already executing. wlgap.android.js:1544
inside wlCommonInit wlgap.android.js:1538
Cannot invoke WL.Client.connect while it is already executing. wlgap.android.js:1544
inside wlCommonInit wlgap.android.js:1538
after: app init onSuccess wlgap.android.js:1538
wlclient init success wlgap.android.js:1538
Failed to load resource: the server responded with a status of 401 (Unauthorized) http://<myhost>/apps/services/api/UnisTestAdapters/android/init
Request [/apps/services/api/UnisTestAdapters/android/init] wlgap.android.js:1538
response [/apps/services/api/UnisTestAdapters/android/init] success: /*-secure-
{"userPrefs":{},"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"2lpeuqgs32jqt15bkbu0hg19j","attributes":{},"isUserAuthenticated":1,"displayName":"2lpeuqgs32jqt15bkbu0hg19j"},"wl_deviceNoProvisioningRealm":{"userId":"previewDummyId","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#15c4c586"},"isUserAuthenticated":1,"displayName":"previewDummyId"},"wl_anonymousUserRealm":{"userId":"a940a5a8-7506-4052-9445-87b8aeeb23f9","attributes":{},"isUserAuthenticated":1,"displayName":"a940a5a8-7506-4052-9445-87b8aeeb23f9"}},"notificationSubscriptionState":{},"gadgetProps":{"ENVIRONMENT":"android"},"userInfo":{"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"UnisaluteAuthRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"SampleAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"2lpeuqgs32jqt15bkbu0hg19j","attributes":{},"isUserAuthenticated":1,"displayName":"2lpeuqgs32jqt15bkbu0hg19j"},"WorklightConsole":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceNoProvisioningRealm":{"userId":"previewDummyId","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#15c4c586"},"isUserAuthenticated":1,"displayName":"previewDummyId"},"myserver":{"userId":"a940a5a8-7506-4052-9445-87b8aeeb23f9","attributes":{},"isUserAuthenticated":1,"displayName":"a940a5a8-7506-4052-9445-87b8aeeb23f9"},"wl_anonymousUserRealm":{"userId":"a940a5a8-7506-4052-9445-87b8aeeb23f9","attributes":{},"isUserAuthenticated":1,"displayName":"a940a5a8-7506-4052-9445-87b8aeeb23f9"}}}*/ wlgap.android.js:1538
wlclient connect success
Request [/apps/services/api/UnisTestAdapters/android/heartbeat] wlgap.android.js:1538
response [/apps/services/api/UnisTestAdapters/android/heartbeat] success: wlgap.android.js:1538
Request [/apps/services/api/UnisTestAdapters/android/heartbeat] wlgap.android.js:1538
response [/apps/services/api/UnisTestAdapters/android/heartbeat] success: wlgap.android.js:1538
Request [/apps/services/api/UnisTestAdapters/android/heartbeat] wlgap.android.js:1538
response [/apps/services/api/UnisTestAdapters/android/heartbeat] success: wlgap.android.js:1538
Request [/apps/services/api/UnisTestAdapters/android/heartbeat] wlgap.android.js:1538
response [/apps/services/api/UnisTestAdapters/android/heartbeat] success: wlgap.android.js:1538
It results that the wlClientInit is called 3 times, until the call to /apps/services/api/UnisTestAdapters/android/init gets a response from the server.
In the while, the call to WL.Client.connect() fails twice because Cannot invoke WL.Client.connect while it is already executing. Then after getting the response from the /init call I also get wlclient connect success.
Given this scenario, I have some questions:
Is the /init call a WL.Client.connect() under-the-covers call? Do both the server invocations carry the same information in the response? In other words, does the /init call act as a WL.Client.connect() ensuring that all the features that need a connect() call are likewise available?
Am I guaranteed by the "retry mechanism" that calls the wlClientInit() until the /init call is terminated allowing the successful call to WL.Client.connect()? Is there any way to prevent the WL.Client.connect() call to fail twice before being successful?
Can you confirm, as I see in the console, that there's a default heartbeat set to prevent the session from timing out? What is that default heartbeat interval?
#Daniel Gonzales: here it is the wlCommonInit() code and related handlers:
function wlCommonInit(){
// Common initialization code goes here
busyind = new WL.BusyIndicator("content");
$('#SubscribeButton').bind('click', subscribeButtonClicked);
$('#UnsubscribeButton').bind('click', unsubscribeButtonClicked);
WL.Client.connect({ onSuccess: connected,
onFailure: notconnected,
timeout: 1000
});
WL.Logger.debug("inside wlCommonInit");
}
function connected(response){
alert("connected");
}
function notconnected(response){
alert("not connected");
}
See these two questions (well, their answers) for some explanations that may help.
IBM Worklight - Connecting/Re-Connecting: WL.Client.connect vs. connectOnStartup vs. WL.Client.invokeProcedure
Worklight method for checking connection
As for Heartbeat, yes, it is enabled by default and has a default of 20 minutes.

WL 5.0.6.1 Android - Updating App (.apk file) on top of installed App causes Web Resources load fail - WebView startup break - at first start

When we are re-compiling the android APK with changes in the JS sources and use Testflight or Eclipse Android Tools to install this APK on top of an already installed APK of the app we are seeing the following problems at the first start of the App (the second time it works):
The following prints are from the AVD with Android 4.3 API 18. The app startup also breaks on the real device, but we do not have debug prints yet.
When we have:
<encryptWebResources enabled="false"/>
then we see:
09-04 13:28:21.908: D/WLDroidGap(2322): New installation/upgrade detected, copying resources and saving new checksum
09-04 13:28:22.417: D/CordovaWebView(2322): DroidGap.loadUrl(file:///data/data/com.App/files/www/default/App.html, 60000)
09-04 13:28:22.417: D/DroidGap(2322): onMessage(splashscreen,show)
09-04 13:28:22.417: D/CordovaWebView(2322): >>> loadUrl(file:///data/data/com.App/files/www/default/App.html)
09-04 13:28:22.417: D/PluginManager(2322): init()
09-04 13:28:22.427: D/CordovaWebView(2322): >>> loadUrlNow()
09-04 13:28:22.427: D/DroidGap(2322): Resuming the App
09-04 13:28:22.497: D/libEGL(2322): loaded /system/lib/egl/libEGL_emulation.so
09-04 13:28:22.507: D/(2322): HostConnection::get() New Host Connection established 0x2a213708, tid 2322
09-04 13:28:22.517: D/libEGL(2322): loaded /system/lib/egl/libGLESv1_CM_emulation.so
09-04 13:28:22.517: D/libEGL(2322): loaded /system/lib/egl/libGLESv2_emulation.so
09-04 13:28:22.577: W/EGL_emulation(2322): eglSurfaceAttrib not implemented
09-04 13:28:22.587: D/OpenGLRenderer(2322): Enabling debug mode 0
09-04 13:28:22.597: D/SoftKeyboardDetect(2322): Ignore this event
09-04 13:28:22.627: W/EGL_emulation(2322): eglSurfaceAttrib not implemented
09-04 13:28:22.838: D/WLDroidGap(2322): Started copying files to local storage...
09-04 13:28:22.928: D/SoftKeyboardDetect(2322): Ignore this event
09-04 13:28:30.978: D/dalvikvm(2322): GC_FOR_ALLOC freed 1561K, 19% free 7469K/9188K, paused 25ms, total 25ms
09-04 13:28:37.098: D/WLDroidGap(2322): Finished copying files to local storage...
09-04 13:28:37.098: D/WLDroidGap(2322): no need to check web resource integrity
09-04 13:28:37.148: D/DroidGap(2322): onMessage(onPageStarted,file:///data/data/com.App/files/www/default/App.html)
09-04 13:28:42.448: E/CordovaWebView(2322): CordovaWebView: TIMEOUT ERROR!
09-04 13:28:42.448: D/Cordova(2322): CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///data/data/com.App/files/www/default/App.html
09-04 13:28:42.448: D/DroidGap(2322): onMessage(onReceivedError,{"errorCode":-6,"url":"file:\/\/\/data\/data\/com.App\/files\/www\/default\/App.html","description":"The connection to the server was unsuccessful."})
When we have:
<encryptWebResources enabled="true"/>
then we see:
App09-04 14:56:46.408: D/dalvikvm(3375): GC_FOR_ALLOC freed 42K, 8% free 2640K/2840K, paused 25ms, total 30ms
09-04 14:56:46.417: I/dalvikvm-heap(3375): Grow heap (frag case) to 3.803MB for 1127536-byte allocation
09-04 14:56:46.447: D/dalvikvm(3375): GC_FOR_ALLOC freed <1K, 6% free 3741K/3944K, paused 34ms, total 34ms
09-04 14:56:46.547: I/CordovaLog(3375): Changing log level to DEBUG(3)
09-04 14:56:46.557: I/CordovaLog(3375): Found preference for exit-on-suspend=false
09-04 14:56:46.557: D/CordovaLog(3375): Found preference for exit-on-suspend=false
09-04 14:56:46.557: I/CordovaLog(3375): Found preference for show-splash-screen-spinner=true
09-04 14:56:46.557: D/CordovaLog(3375): Found preference for show-splash-screen-spinner=true
09-04 14:56:46.577: D/JsMessageQueue(3375): Set native->JS mode to 2
09-04 14:56:46.637: D/DroidGap(3375): DroidGap.init()
09-04 14:56:46.748: D/dalvikvm(3375): GC_FOR_ALLOC freed 121K, 7% free 3802K/4080K, paused 39ms, total 39ms
09-04 14:56:46.778: I/dalvikvm-heap(3375): Grow heap (frag case) to 7.379MB for 3686416-byte allocation
09-04 14:56:46.808: D/dalvikvm(3375): GC_FOR_ALLOC freed <1K, 4% free 7402K/7684K, paused 29ms, total 29ms
09-04 14:56:46.828: D/WLDroidGap(3375): New installation/upgrade detected, copying resources and saving new checksum
09-04 14:56:47.278: D/CordovaWebView(3375): DroidGap.loadUrl(file:///data/data/com.App/files/www/default/App.html, 60000)
09-04 14:56:47.278: D/DroidGap(3375): onMessage(splashscreen,show)
09-04 14:56:47.278: D/CordovaWebView(3375): >>> loadUrl(file:///data/data/com.App/files/www/default/App.html)
09-04 14:56:47.278: D/PluginManager(3375): init()
09-04 14:56:47.288: D/CordovaWebView(3375): >>> loadUrlNow()
09-04 14:56:47.298: D/DroidGap(3375): Resuming the App
09-04 14:56:47.367: D/libEGL(3375): loaded /system/lib/egl/libEGL_emulation.so
09-04 14:56:47.367: D/(3375): HostConnection::get() New Host Connection established 0x2a21e670, tid 3375
09-04 14:56:47.387: D/libEGL(3375): loaded /system/lib/egl/libGLESv1_CM_emulation.so
09-04 14:56:47.387: D/libEGL(3375): loaded /system/lib/egl/libGLESv2_emulation.so
09-04 14:56:47.428: W/EGL_emulation(3375): eglSurfaceAttrib not implemented
09-04 14:56:47.447: D/OpenGLRenderer(3375): Enabling debug mode 0
09-04 14:56:47.457: D/SoftKeyboardDetect(3375): Ignore this event
09-04 14:56:47.487: W/EGL_emulation(3375): eglSurfaceAttrib not implemented
09-04 14:56:47.668: D/WLDroidGap(3375): Started copying files to local storage...
09-04 14:56:47.677: D/WLDroidGap(3375): Found resources zip stream. Starting decryption and unzipping process.
09-04 14:56:47.687: I/dalvikvm(3375): Could not find method com.worklight.utils.PaidSecurityUtils.kpg, referenced from method com.worklight.utils.SecurityUtils.kpg
09-04 14:56:47.687: W/dalvikvm(3375): VFY: unable to resolve static method 8750: Lcom/worklight/utils/PaidSecurityUtils;.kpg (Landroid/content/Context;[Ljava/lang/String;)[B
09-04 14:56:47.687: D/dalvikvm(3375): VFY: replacing opcode 0x71 at 0x0000
09-04 14:56:47.798: D/SoftKeyboardDetect(3375): Ignore this event
09-04 14:56:47.898: I/dalvikvm(3375): Total arena pages for JIT: 11
09-04 14:56:47.898: I/dalvikvm(3375): Total arena pages for JIT: 12
09-04 14:56:47.898: I/dalvikvm(3375): Total arena pages for JIT: 13
09-04 14:56:47.898: I/dalvikvm(3375): Total arena pages for JIT: 14
09-04 14:56:47.898: I/dalvikvm(3375): Total arena pages for JIT: 15
09-04 14:56:47.908: I/dalvikvm(3375): Total arena pages for JIT: 16
09-04 14:56:47.908: I/dalvikvm(3375): Total arena pages for JIT: 17
09-04 14:56:47.938: I/dalvikvm(3375): Total arena pages for JIT: 18
09-04 14:56:54.987: D/dalvikvm(3375): GC_FOR_ALLOC freed 1500K, 19% free 7536K/9192K, paused 25ms, total 25ms
09-04 14:56:56.067: D/WLDroidGap(3375): Resources.zip unzipped
09-04 14:56:56.067: D/WLDroidGap(3375): Finished copying files to local storage...
09-04 14:56:56.077: D/WLDroidGap(3375): no need to check web resource integrity
09-04 14:56:56.127: D/DroidGap(3375): onMessage(onPageStarted,file:///data/data/com.App/files/www/default/App.html)
09-04 14:57:03.768: E/cutils-trace(3375): Error opening trace file: No such file or directory (2)
09-04 14:57:06.108: D/CordovaLog(3375): [object Object]
09-04 14:57:06.108: I/Web Console(3375): [object Object] at file:///data/data/com.App/files/www/default/js/appNav.js:174
09-04 14:57:07.318: E/CordovaWebView(3375): CordovaWebView: TIMEOUT ERROR!
09-04 14:57:07.318: D/Cordova(3375): CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///data/data/com.App/files/www/default/App.html
09-04 14:57:07.327: D/DroidGap(3375): onMessage(onReceivedError,{"errorCode":-6,"url":"file:\/\/\/data\/data\/com.App\/files\/www\/default\/App.html","description":"The connection to the server was unsuccessful."})
09-04 14:57:07.567: D/SoftKeyboardDetect(3375): Ignore this event
09-04 14:57:07.808: W/EGL_emulation(3375): eglSurfaceAttrib not implemented
09-04 14:57:07.968: D/Cordova(3375): onPageFinished(file:///data/data/com.App/files/www/default/App.html)
09-04 14:57:07.979: D/DroidGap(3375): onMessage(onNativeReady,null)
09-04 14:57:07.979: D/DroidGap(3375): onMessage(onPageFinished,file:///data/data/com.App/files/www/default/App.html)
09-04 14:57:08.088: E/SQLiteLog(3375): (14) cannot open file at line 30191 of [00bb9c9ce4]
09-04 14:57:08.098: E/SQLiteLog(3375): (14) os_unix.c:30191: (2) open(/CachedGeoposition.db) -
09-04 14:57:08.098: D/WebKit(3375): ERROR:
09-04 14:57:08.098: D/WebKit(3375): SQLite database failed to load from /CachedGeoposition.db
09-04 14:57:08.098: D/WebKit(3375): Cause - unable to open database file
09-04 14:57:08.098: D/WebKit(3375): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
09-04 14:57:08.228: D/CordovaNetworkManager(3375): Connection Type: 3g
09-04 14:57:08.238: D/DroidGap(3375): onMessage(networkconnection,3g)
09-04 14:57:08.248: D/CordovaNetworkManager(3375): Connection Type: 3g
09-04 14:57:08.288: D/DroidGap(3375): onMessage(spinner,stop)
09-04 14:57:08.288: D/SoftKeyboardDetect(3375): Ignore this event
09-04 14:57:08.327: D/TilesManager(3375): Starting TG #0, 0x2a2d6440
09-04 14:57:08.338: D/TilesManager(3375): new EGLContext from framework: 2a21e9c0
09-04 14:57:08.338: D/GLWebViewState(3375): Reinit shader
09-04 14:57:08.387: D/App(3375): ondeviceready event dispatched
09-04 14:57:08.427: D/App(3375): wlclient init started
09-04 14:57:08.447: D/App(3375): Read cookies: null
09-04 14:57:08.457: D/App(3375): CookieMgr read cookies: {}
09-04 14:57:08.657: D/App(3375): Request [http://XXX:8080/apps/services/api/App/android/init]
09-04 14:57:08.868: D/GLWebViewState(3375): Reinit transferQueue
09-04 14:57:09.118: D/(3375): HostConnection::get() New Host Connection established 0x2a8da1b0, tid 3405
09-04 14:57:09.278: W/EGL_emulation(3375): eglSurfaceAttrib not implemented
09-04 14:57:09.577: D/App(3375): Request [http://XXX:8080/apps/services/api/App/android/init]
09-04 14:57:09.778: D/App(3375): response [http://XXX:8080/apps/services/api/App/android/init] success: /*-secure-
09-04 14:57:09.778: D/App(3375): {"userPrefs":{},"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"cov37tnm5kcuievnjlq18ruh6k","attributes":{},"isUserAuthenticated":1,"displayName":"cov37tnm5kcuievnjlq18ruh6k"},"wl_deviceNoProvisioningRealm":{"userId":"71ecfc9e-69f1-41c7-9007-7da6e31207f1","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#1df9ea5f"},"isUserAuthenticated":1,"displayName":"71ecfc9e-69f1-41c7-9007-7da6e31207f1"},"wl_anonymousUserRealm":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"}},"gadgetProps":{"ENVIRONMENT":"android"},"userInfo":{"SubscribeServlet":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"SampleAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"cov37tnm5kcuievnjlq18ruh6k","attributes":{},"isUserAuthenticated":1,"displayName":"cov37tnm5kcuievnjlq18ruh6k"},"WorklightConsole":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceNoProvisioningRealm":{"userId":"71ecfc9e-69f1-41c7-9007-7da6e31207f1","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#1df9ea5f"},"isUserAuthenticated":1,"displayName":"71ecfc9e-69f1-41c7-9007-7da6e31207f1"},"myserver":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"},"wl_anonymousUserRealm":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"}}}*/
09-04 14:57:09.798: D/App(3375): wlclient connect success
09-04 14:57:09.868: E/App(3375): [http://XXX:8080/apps/services/api/App/android/init] exception. Cannot read property 'skinLoaderContent' of undefined
09-04 14:57:09.948: D/CordovaLog(3375): Uncaught TypeError: Cannot read property 'skinLoaderContent' of undefined
09-04 14:57:09.948: E/Web Console(3375): Uncaught TypeError: Cannot read property 'skinLoaderContent' of undefined at file:///data/data/com.App/files/www/default/wlclient/js/worklight.js:1487
It seems like some sort of race-condition with copying files and opening files in the webview...
We tried some experiments that all had the same results as presented above:
we changed the "connectOnStartup" to false and WL.Client.connect connected manually to WL server in wlCommonInit()
increased the initOption timeout
The following seemed to reduce the problem... but it did not remove the problem. Only fewer breaks when trying it several times:
increasing the Android Application Environment Version in the application-descriptor every time before re-compile. (which would be done before publishing to Google Play Store!)
The following seemed to eliminate the problem:
swapping the encryptWebResources parameter true/false every time before a re-compile and deploy, apk install
not connecting to the WL Server at startup at all ... no connectOnStartup and no WL.Client.connect in wlCommonInit().
Has anyone ever encountered this problem and would have some suggestions on how to work around it?
There seems to be a native way to catch the onReceiveError Cordova event that is being fired in the first case above - but worklight is not doing that?:
Catching phonegap GapViewClient.onReceivedError in javascript
This is the output when the startup is successful (e.g. after swapping encryptWebResources parameter):
App09-04 15:22:01.378: D/dalvikvm(3575): GC_FOR_ALLOC freed 53K, 8% free 2640K/2852K, paused 25ms, total 30ms
09-04 15:22:01.388: I/dalvikvm-heap(3575): Grow heap (frag case) to 3.803MB for 1127536-byte allocation
09-04 15:22:01.418: D/dalvikvm(3575): GC_FOR_ALLOC freed <1K, 6% free 3741K/3956K, paused 35ms, total 35ms
09-04 15:22:01.518: I/CordovaLog(3575): Changing log level to DEBUG(3)
09-04 15:22:01.528: I/CordovaLog(3575): Found preference for exit-on-suspend=false
09-04 15:22:01.538: D/CordovaLog(3575): Found preference for exit-on-suspend=false
09-04 15:22:01.538: I/CordovaLog(3575): Found preference for show-splash-screen-spinner=true
09-04 15:22:01.538: D/CordovaLog(3575): Found preference for show-splash-screen-spinner=true
09-04 15:22:01.578: D/JsMessageQueue(3575): Set native->JS mode to 2
09-04 15:22:01.578: D/DroidGap(3575): DroidGap.init()
09-04 15:22:01.717: D/dalvikvm(3575): GC_FOR_ALLOC freed 120K, 7% free 3802K/4080K, paused 36ms, total 37ms
09-04 15:22:01.747: I/dalvikvm-heap(3575): Grow heap (frag case) to 7.378MB for 3686416-byte allocation
09-04 15:22:01.787: D/dalvikvm(3575): GC_FOR_ALLOC freed <1K, 4% free 7402K/7684K, paused 32ms, total 32ms
09-04 15:22:01.797: D/WLDroidGap(3575): New installation/upgrade detected, copying resources and saving new checksum
09-04 15:22:02.248: D/CordovaWebView(3575): DroidGap.loadUrl(file:///data/data/com.App/files/www/skinLoader.html, 60000)
09-04 15:22:02.248: D/DroidGap(3575): onMessage(splashscreen,show)
09-04 15:22:02.248: D/CordovaWebView(3575): >>> loadUrl(file:///data/data/com.App/files/www/skinLoader.html)
09-04 15:22:02.248: D/PluginManager(3575): init()
09-04 15:22:02.258: D/CordovaWebView(3575): >>> loadUrlNow()
09-04 15:22:02.258: D/DroidGap(3575): Resuming the App
09-04 15:22:02.338: D/libEGL(3575): loaded /system/lib/egl/libEGL_emulation.so
09-04 15:22:02.338: D/(3575): HostConnection::get() New Host Connection established 0x2a23a318, tid 3575
09-04 15:22:02.348: D/libEGL(3575): loaded /system/lib/egl/libGLESv1_CM_emulation.so
09-04 15:22:02.358: D/libEGL(3575): loaded /system/lib/egl/libGLESv2_emulation.so
09-04 15:22:02.418: W/EGL_emulation(3575): eglSurfaceAttrib not implemented
09-04 15:22:02.428: D/OpenGLRenderer(3575): Enabling debug mode 0
09-04 15:22:02.437: D/SoftKeyboardDetect(3575): Ignore this event
09-04 15:22:02.468: W/EGL_emulation(3575): eglSurfaceAttrib not implemented
09-04 15:22:02.627: D/WLDroidGap(3575): Started copying files to local storage...
09-04 15:22:02.747: D/SoftKeyboardDetect(3575): Ignore this event
09-04 15:22:10.618: D/dalvikvm(3575): GC_FOR_ALLOC freed 1563K, 19% free 7469K/9192K, paused 24ms, total 25ms
09-04 15:22:16.718: D/WLDroidGap(3575): Finished copying files to local storage...
09-04 15:22:16.728: D/WLDroidGap(3575): no need to check web resource integrity
09-04 15:22:16.778: D/DroidGap(3575): onMessage(onPageStarted,file:///data/data/com.App/files/www/skinLoader.html)
09-04 15:22:17.458: D/chromium(3575): Unknown chromium error: -6
09-04 15:22:17.488: D/Cordova(3575): onPageFinished(file:///data/data/com.App/files/www/skinLoader.html)
09-04 15:22:17.488: D/DroidGap(3575): onMessage(onNativeReady,null)
09-04 15:22:17.488: D/DroidGap(3575): onMessage(onPageFinished,file:///data/data/com.App/files/www/skinLoader.html)
09-04 15:22:17.498: E/cutils-trace(3575): Error opening trace file: No such file or directory (2)
09-04 15:22:17.558: E/SQLiteLog(3575): (14) cannot open file at line 30191 of [00bb9c9ce4]
09-04 15:22:17.558: E/SQLiteLog(3575): (14) os_unix.c:30191: (2) open(/CachedGeoposition.db) -
09-04 15:22:17.558: D/WebKit(3575): ERROR:
09-04 15:22:17.558: D/WebKit(3575): SQLite database failed to load from /CachedGeoposition.db
09-04 15:22:17.558: D/WebKit(3575): Cause - unable to open database file
09-04 15:22:17.558: D/WebKit(3575): external/webkit/Source/WebCore/platform/sql/SQLiteDatabase.cpp(71) : bool WebCore::SQLiteDatabase::open(const WTF::String&, bool)
09-04 15:22:17.678: D/CordovaNetworkManager(3575): Connection Type: 3g
09-04 15:22:17.678: D/DroidGap(3575): onMessage(networkconnection,3g)
09-04 15:22:17.688: D/CordovaNetworkManager(3575): Connection Type: 3g
09-04 15:22:17.738: D/DroidGap(3575): onMessage(spinner,stop)
09-04 15:22:17.758: D/TilesManager(3575): Starting TG #0, 0x2a23d728
09-04 15:22:17.758: D/TilesManager(3575): new EGLContext from framework: 2a23a668
09-04 15:22:17.758: D/GLWebViewState(3575): Reinit shader
09-04 15:22:17.837: D/GLWebViewState(3575): Reinit transferQueue
09-04 15:22:17.873: D/CordovaWebView(3575): >>> loadUrl(file:///data/data/com.App/files/www/default/App.html)
09-04 15:22:17.877: D/CordovaWebView(3575): >>> loadUrlNow()
09-04 15:22:17.897: D/DroidGap(3575): onMessage(onPageStarted,file:///data/data/com.App/files/www/default/App.html)
09-04 15:22:19.508: D/DroidGap(3575): onMessage(spinner,stop)
09-04 15:22:26.567: D/CordovaLog(3575): [object Object]
09-04 15:22:26.567: I/Web Console(3575): [object Object] at file:///data/data/com.App/files/www/default/js/appNav.js:174
09-04 15:22:27.898: D/Cordova(3575): onPageFinished(file:///data/data/com.App/files/www/default/App.html)
09-04 15:22:27.898: D/DroidGap(3575): onMessage(onNativeReady,null)
09-04 15:22:27.908: D/DroidGap(3575): onMessage(onPageFinished,file:///data/data/com.App/files/www/default/App.html)
09-04 15:22:27.948: D/(3575): HostConnection::get() New Host Connection established 0x2a6ca158, tid 3605
09-04 15:22:28.118: D/CordovaNetworkManager(3575): Connection Type: 3g
09-04 15:22:28.128: D/CordovaNetworkManager(3575): Connection Type: 3g
09-04 15:22:28.148: D/DroidGap(3575): onMessage(networkconnection,3g)
09-04 15:22:28.168: D/DroidGap(3575): onMessage(spinner,stop)
09-04 15:22:28.188: D/App(3575): ondeviceready event dispatched
09-04 15:22:28.258: D/App(3575): wlclient init started
09-04 15:22:28.288: D/App(3575): Read cookies: null
09-04 15:22:28.298: D/App(3575): CookieMgr read cookies: {}
09-04 15:22:28.577: D/dalvikvm(3575): GC_FOR_ALLOC freed 774K, 18% free 7613K/9232K, paused 61ms, total 67ms
09-04 15:22:28.607: D/App(3575): Request [http://XXX:8080/apps/services/api/App/android/init]
09-04 15:22:28.768: W/EGL_emulation(3575): eglSurfaceAttrib not implemented
09-04 15:22:29.477: D/App(3575): Request [http://XXX:8080/apps/services/api/App/android/init]
09-04 15:22:29.587: D/App(3575): response [http://XXX:8080/apps/services/api/App/android/init] success: /*-secure-
09-04 15:22:29.587: D/App(3575): {"userPrefs":{},"WL-Authentication-Success":{"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"dnp53p3bq3h02g6d6bpkgs7al0","attributes":{},"isUserAuthenticated":1,"displayName":"dnp53p3bq3h02g6d6bpkgs7al0"},"wl_deviceNoProvisioningRealm":{"userId":"71ecfc9e-69f1-41c7-9007-7da6e31207f1","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#7483ddc7"},"isUserAuthenticated":1,"displayName":"71ecfc9e-69f1-41c7-9007-7da6e31207f1"},"wl_anonymousUserRealm":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"}},"gadgetProps":{"directUpdate":{"updateUnpackedSize":4464136,"availableSkins":["default"],"checksum":4181283381,"updateSize":1934792},"ENVIRONMENT":"android"},"userInfo":{"SubscribeServlet":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_authenticityRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"SampleAppRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_remoteDisableRealm":{"userId":"null","attributes":{},"isUserAuthenticated":1,"displayName":"null"},"wl_antiXSRFRealm":{"userId":"dnp53p3bq3h02g6d6bpkgs7al0","attributes":{},"isUserAuthenticated":1,"displayName":"dnp53p3bq3h02g6d6bpkgs7al0"},"WorklightConsole":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceAutoProvisioningRealm":{"userId":null,"attributes":{},"isUserAuthenticated":0,"displayName":null},"wl_deviceNoProvisioningRealm":{"userId":"71ecfc9e-69f1-41c7-9007-7da6e31207f1","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData#7483ddc7"},"isUserAuthenticated":1,"displayName":"71ecfc9e-69f1-41c7-9007-7da6e31207f1"},"myserver":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"},"wl_anonymousUserRealm":{"userId":"74a2c152-5a50-4d73-9644-177b7db04c9b","attributes":{},"isUserAuthenticated":1,"displayName":"74a2c152-5a50-4d73-9644-177b7db04c9b"}}}*/
09-04 15:22:29.597: D/App(3575): wlclient connect success
09-04 15:22:29.637: D/App(3575): before: app init onSuccess
09-04 15:22:29.637: D/App(3575): in startBusyIndicator
09-04 15:22:29.648: D/App(3575): busyIndicator is null or not visible, so create and show
09-04 15:22:29.668: D/App(3575): Exiting startBusyIndicator: [object Object]
09-04 15:22:29.668: D/App(3575): WL.Client.connect by-passed
09-04 15:22:29.868: W/EGL_emulation(3575): eglSurfaceAttrib not implemented
09-04 15:22:29.898: D/App(3575): after: app init onSuccess
09-04 15:22:29.898: D/App(3575): wlclient init success
09-04 15:22:30.297: D/App(3575): Request [http://XXX:8080/apps/services/api/App/android/query]
09-04 15:22:30.467: D/CordovaLog(3575): [object Object]
09-04 15:22:30.467: I/Web Console(3575): [object Object] at file:///data/data/com.App/files/www/default/js/appNav.js:174
09-04 15:22:31.347: D/Cordova(3575): onPageFinished(file:///data/data/com.App/files/www/default/App.html#/data/data/com.App/files/www/default/pages/home/Home.html)
09-04 15:22:31.347: D/DroidGap(3575): onMessage(onNativeReady,null)
09-04 15:22:31.347: D/DroidGap(3575): onMessage(onPageFinished,file:///data/data/com.App/files/www/default/App.html#/data/data/com.App/files/www/default/pages/home/Home.html)
09-04 15:22:31.547: D/App(3575): response [http://XXX:8080/apps/services/api/App/android/query] success: /*-secure-
09-04 15:22:31.547: D/App(3575): {"responseID":"574","result":{"travelAdvisory"}},"isSuccessful":true}*/
09-04 15:22:31.618: E/App(3575): [http://XXX:8080/apps/services/api/App/android/query] exception. Cannot read property 'question' of undefined
09-04 15:22:31.767: D/CordovaLog(3575): Uncaught TypeError: Cannot read property 'question' of undefined
09-04 15:22:31.767: E/Web Console(3575): Uncaught TypeError: Cannot read property 'question' of undefined at file:///data/data/com.App/files/www/default/wlclient/js/worklight.js:1487
09-04 15:22:35.187: D/App(3575): Hiding splash screen
09-04 15:22:35.197: D/App(3575): in stopBusyIndicator: [object Object]
09-04 15:22:35.207: D/DroidGap(3575): onMessage(splashscreen,hide)
09-04 15:22:36.218: D/App(3575): Calling initializeAirportLookupData
09-04 15:22:59.908: D/App(3575): Hiding splash screen
09-04 15:22:59.908: D/App(3575): in stopBusyIndicator: [object Object]
09-04 15:22:59.917: D/DroidGap(3575): onMessage(splashscreen,hide)
UPDATE on Device Tests
On the test device LG Optimus G with Android 4.1.2 the Error of the second case above with:
09-04 14:57:09.798: D/App(3375): wlclient connect success
09-04 14:57:09.868: E/App(3375): [http://XXX:8080/apps/services/api/App/android/init] exception. Cannot read property 'skinLoaderContent' of undefined
09-04 14:57:09.948: D/CordovaLog(3375): Uncaught TypeError: Cannot read property 'skinLoaderContent' of undefined
09-04 14:57:09.948: E/Web Console(3375): Uncaught TypeError: Cannot read property 'skinLoaderContent' of undefined at file:///data/data/com.App/files/www/default/wlclient/js/worklight.js:1487
happens every second time we "Run As" "Android Application" on the USB connected device. The other times in-between work successfully without error.
When we do not connect at startup it always works fine.
An update was recently issued to Worklight 5.0.6.x and above with significant improvements regarding the amount of time the user must wait when Worklight applications are started for the first time.
See relevant IBM tech note: http://www-01.ibm.com/support/docview.wss?uid=swg27040464
I suggest for the customer get a newer version of 5.0.6.1 (= iFix), or wait for 5.0.6.2 (= Fixpack) to be released, soon.

Appcelerator and CommonJS modules (caching and circular references)

Here's the thing:
I'm using the CommonJS way of making my mobile (iPhone/Android) application modular. No surprise there. But there's one thing that I just can't get my head around.
CommonJS lets me create STATIC private variables, which lets me create singletons at ease. This, I think at least, is because the contents of a file that gets require()d is read only once and then the exports object (which is initialized only once) is returned every time.
But when I create a circular reference as seen below, the code inside the included module is executed every time.
Wait...
Funny thing is, while I'm writing this question, I suddenly realise that none of the calls to require() finish before the next one starts (hence the stack overflow demonstrated below).
Any thoughts on whether I'm on track or not? It's past 5 AM over here, so all bets are off as far as I'm concerned :D.
EXAMPLES:
See this piece of code, it defines a singleton:
/* Singleton.js */
exports.getSingleton = getSingleton;
function getSingleton(name) {
if (!instance) {
instance = new Thing(name);
}
return instance;
}
function Thing(name) {
this.name = name;
}
var instance;
I require() this file as such:
var theFirstThing = require('Singleton').getSingleton('first');
Ti.API.info('first: ' + theFirstThing.name)
var possiblyAnotherOtherThing = require('Singleton').getSingleton('second');
Ti.API.info('second: ' + possiblyAnotherOtherThing.name);
The Output is:
[DEBUG] loading: /path/to/sim/MyApp.app/app.js, resource: app_js
[DEBUG] loading: /path/to/sim/MyApp.app/Singleton.js, resource: Singleton_js
[INFO] first: first
[INFO] second: first
Why is it then that circular references like the following don't work? (I might have already ansered this myself, comment/answer on it if you like).
app.js
require('Banana');
Pinapple.js
require('Banana');
Banana.js
require('Pineapple');
Because the output is this:
[DEBUG] loading: /path/to/simulator/MyApp.app/app.js, resource: app_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Banana.js, resource: Banana_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Pineapple.js, resource: Pineapple_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Banana.js, resource: Banana_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Pineapple.js, resource: Pineapple_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Banana.js, resource: Banana_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Pineapple.js, resource: Pineapple_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Banana.js, resource: Banana_js
/* etcetera (total of 15 times back and forth) */
[DEBUG] loading: /path/to/simulator/MyApp.app/Pineapple.js, resource: Pineapple_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Banana.js, resource: Banana_js
[DEBUG] loading: /path/to/simulator/MyApp.app/Pineapple.js, resource: Pineapple_js
[ERROR] Script Error = Maximum call stack size exceeded. (unknown file)
I too am using CommonJS modules in Appcelerator Titanium to build a mobile app. What I did to resolve the circular dependency problem was this: if A and B are the 2 circularly-dependent modules, require(A) in B, and vice-versa just before you actually need to use it. In my case, I needed A inside B only when a certain button got clicked, so I put a require(A) in B inside the button's click event listener. Hope that helps.