Worklight Uncaught TypeError for multiple javascri

2019-08-28 05:52发布

问题:

I am using Worklight 6 and when i try to run the application in preview mode or in android emulator I have the following Uncaught TypeErrors:

02-28 00:13:19.727: D/CordovaLog(562): Uncaught TypeError: Cannot read property 'UNSUPPORTED_BROWSER' of undefined
02-28 00:13:19.727: E/Web Console(562): Uncaught TypeError: Cannot read property 'UNSUPPORTED_BROWSER' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/wlclient.js:142
02-28 00:13:20.107: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined
02-28 00:13:20.107: E/Web Console(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/encryptedcache.js:24
02-28 00:13:20.247: D/CordovaLog(562): Uncaught TypeError: Cannot read property 'ANDROID' of undefined
02-28 00:13:20.247: E/Web Console(562): Uncaught TypeError: Cannot read property 'ANDROID' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/analytics/analytics.js:43
02-28 00:13:20.347: D/CordovaLog(562): Uncaught TypeError: Cannot set property 'startAcquisition' of undefined
02-28 00:13:20.347: E/Web Console(562): Uncaught TypeError: Cannot set property 'startAcquisition' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/deviceSensors/acquisition.js:50
02-28 00:13:20.417: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined
02-28 00:13:20.417: E/Web Console(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/deviceSensors/geo.js:22
02-28 00:13:20.457: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined
02-28 00:13:20.457: E/Web Console(562): Uncaught TypeError: Cannot call method 'getEnvironment' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/deviceSensors/wifi.js:399
02-28 00:13:20.527: D/CordovaLog(562): Uncaught TypeError: Cannot set property 'transmitEvent' of undefined
02-28 00:13:20.527: E/Web Console(562): Uncaught TypeError: Cannot set property 'transmitEvent' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/events/eventTransmitter.js:320
02-28 00:13:20.547: D/CordovaLog(562): Uncaught TypeError: Cannot set property 'setKeepAliveInBackground' of undefined
02-28 00:13:20.547: E/Web Console(562): Uncaught TypeError: Cannot set property 'setKeepAliveInBackground' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/deviceSensors/bind.js:21
02-28 00:13:20.627: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined
02-28 00:13:20.627: E/Web Console(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/challengeHandlers/antiXSRFChallengeHandler.js:12
02-28 00:13:20.647: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined
02-28 00:13:20.647: E/Web Console(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/challengeHandlers/authenticityChallengeHandler.js:12
02-28 00:13:20.667: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'createProvisioningChallengeHandler' of undefined
02-28 00:13:20.667: E/Web Console(562): Uncaught TypeError: Cannot call method 'createProvisioningChallengeHandler' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/challengeHandlers/deviceAuthAutoProvisioningChallengeHandler.js:11
02-28 00:13:20.677: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'createDeviceAuthChallengeHandler' of undefined
02-28 00:13:20.687: E/Web Console(562): Uncaught TypeError: Cannot call method 'createDeviceAuthChallengeHandler' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/challengeHandlers/deviceAuthNoProvisioningChallengeHandler.js:10
02-28 00:13:20.698: D/CordovaLog(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined
02-28 00:13:20.698: E/Web Console(562): Uncaught TypeError: Cannot call method 'createWLChallengeHandler' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js:11
02-28 00:13:20.757: D/CordovaLog(562): Uncaught TypeError: Cannot set property 'extendedGeolocation' of undefined
02-28 00:13:20.757: E/Web Console(562): Uncaught TypeError: Cannot set property 'extendedGeolocation' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/deviceSensors/ExtendedGeolocation.js:237
02-28 00:13:20.837: D/CordovaLog(562): Uncaught TypeError: Cannot set property 'openURL' of undefined
02-28 00:13:20.837: E/Web Console(562): Uncaught TypeError: Cannot set property 'openURL' of undefined at file:///data/data/com.hBC/files/www/default/wlclient/js/wlgap.android.js:33

*(hBC is the name of the project)

When i am trying to run the project in mobile simulator i receive the following errors:

    [ERROR] SRVE0777E: Exception thrown by application class  'org.apache.commons.io.FileUtils.openInputStream:190'
java.io.IOException: File 'C:\Users\ADMIN\lastWS_Worklight_h\WorklightServerConfig\servers\worklight\workarea\org.eclipse.osgi\bundles\72\data\temp\default_node\SMF_WebContainer\hBC\hBC\widget-resources\hBC-android-1.0-67e5a1b0bfe38851fb5006a11b77200e930e4636\preview\default' exists but is a directory
at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:190)
at [internal classes]
at com.worklight.gadgets.serving.WebServingServletBase.writeResponse(WebServingServletBase.java:131)
at com.worklight.gadgets.serving.WebServingServletBase.sendResourceResponse(WebServingServletBase.java:78)
at com.worklight.gadgets.serving.PreviewServlet.respondToRequest(PreviewServlet.java:71)
at com.worklight.gadgets.serving.WebServingServletBase.doGetOrPost(WebServingServletBase.java:60)
at com.worklight.gadgets.serving.WebServingServletBase.doGet(WebServingServletBase.java:44)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
at [internal classes]
at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:199)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:203)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]

[ERROR   ] FWLSE0048E: Unhandled exception caught: java.io.IOException: File 'C:\Users\ADMIN\lastWS_Worklight_h\WorklightServerConfig\servers\worklight\workarea\org.eclipse.osgi\bundles\72\data\temp\default_node\SMF_WebContainer\hBC\hBC\widget-resources\hBC-android-1.0-67e5a1b0bfe38851fb5006a11b77200e930e4636\preview\default' exists but is a directory [project hBC]
java.io.IOException: File 'C:\Users\ADMIN\lastWS_Worklight_h\WorklightServerConfig\servers\worklight\workarea\org.eclipse.osgi\bundles\72\data\temp\default_node\SMF_WebContainer\hBC\hBC\widget-resources\hBC-android-1.0-67e5a1b0bfe38851fb5006a11b77200e930e4636\preview\default' exists but is a directory
[ERROR   ] Error Page Exception: 
                                                                                               hBC
                                                                                               /hBC
                                                                                                   Error Page Exception
                                                                                               com.ibm.ws.webcontainer.webapp.WebAppErrorReport: java.io.IOException: Stream is closed
at com.ibm.wsspi.http.HttpOutputStream.validate(HttpOutputStream.java:187)
at [internal classes]
Caused by: java.io.IOException: Stream is closed
... 3 more

[WARNING ] WARNING: Cannot set status. Response already committed.
[WARNING ] SRVE8094W: WARNING: Cannot set header. Response already committed.

I tried a fresh install in eclipse for ADT and Worklight, but was not a good idea. I installed the latest version of Worklight and the same errors are present.

After a clean project still nothing.I have to mention that i do not have any missing library marked in build path.

I would greatly appreciate any help.

回答1:

  1. Use 6.0.0.2: http://www-01.ibm.com/support/docview.wss?uid=swg24036987
  2. Verify you have full read and write permissions for the location where you have Worklight/application server installed
  3. Delete any Worklight* folders in AppData/Temp