Worklight 6.2: Reference Error: WLJQ is not defined - ibm-mobilefirst

My project was working fine before. After I added a few css files and js files from the other project, the preview as common resource or mobilesimulator produced this error. I have tried the suggested methods in this discussion thread (remove the folders in the temp dir, clean the project and reboot). But still could not fix it. Anything special in Worklight 6.2? Thanks.
IBM Worklight 6.1 - Uncaught ReferenceErrors: WLJQ is not defined, WL is not defined
Fang

I had this problem and after working on a app for a while and then closing down eclipse. On restart I'd often get this problem when working in the browser. I'd delete the $TMPDIR/wl* folders but with no luck.
I had a tip given to me this weekend which seems to work.
Right click on the common folder within your app in WL Studio and Click Run As > Preview.
It seems if you do this at least once it resolves the problem. Not sure why it works, but it works for me and is much quicker than exporting the project and importing it into another workspace... which also works.

Try to export and re-import the project into a new workspace. I had this issue once, and this helped.
IBM Worklight 6.1 - Uncaught ReferenceErrors: WLJQ is not defined, WL is not defined

Related

Worklight error: File not found: /css/images/wl_app_warning.png

I have found an issue with my worklight project. What i have done here is as follows:
I have a project which was built and deployed without any issues.
I wanted to edit most of the images and re-arrange the whole images folder structure.
So I deleted all the contents in the images folder completely from eclipse so that i can save each new image to the newly created folders
Now, i created new folders in images folder and saved one image to one of the newly created folders.
I tried to run the application on mobileFirst development server and started getting the error message:
"SRVE0190E: File not found: /css/images/wl_app_warning.png"
We did not even have a folder named images in css folder before.
This is what happened for me and does this give any clue for the issue??
Please help.
This is a defect in the admin service, and is tracked as APAR PI51055, which you can find more information about here:
http://www-01.ibm.com/support/docview.wss?uid=swg1PI51055
The issue has been corrected in iFix IF20151103-1015 and later builds.
If you have paid support, you will be able to download an iFix build from IBM Fix Central sometime soon that includes this fix - it is not out there for download right now, but I expect it will be within a couple of weeks. If you need the fix before it appears on IBM Fix Central, you can open a PMR and ask the support team to provide it. If you are using the free Developer Edition from the Eclipse Marketplace, I expect the fix will appear there soon also, and you can use the Eclipse software update function to get it, but I am not sure how frequently the Developer Edition repository is updated.
In my project I created an "images" folder with an image:
I then used it in the HTML:
<img src="css/images/wl_app_warning.png"/>
No errors and the image is displayed...

Can't use background task in Windows Phone 8.1 (the ID_CAP_NETWORKING required, but it's included in the manifest)

I need to update my Windows Phone application tile by downloading and parsing JSON. So I'm using Microsoft HTTP Client Libraries.
And I've always got the exception Use of networking APIs requires the ID_CAP_NETWORKING capability to be defined in the application manifest when I'm trying to debug background task.
But my manifest included ID_CAP_NETWORKING as required (screenshot https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-xaf1/t31.0-8/10750111_821340111262044_6461333323674658178_o.jpg).
I don't know what to do. I tried rebuild or recreate the app, but this didn't help. Also I can't find any documentation or an answer on the internet.
Can you please write, what can I do to solve this problem?
This is demo project http://1drv.ms/1yjHm49 with reproduced problem (project's name is 'Meduza. Windows Phone').
I debug my application on Lumia 720 (if it can help).
I re-downloaded your project and now I get your error. So I thought, I must of done something before launching your project that fixed it.
It took me while, but I can get your project to work by doing this
Unzip project to directory
Open Project
Clean Project
Add Internet (Client and Server) in Package.appxmanifest file (make sure you save it before exiting)
Put the break points in your background task
And it works. So a combination of Clean Build + editing the Package.appxmanifest did the trick for me.

How to Fix No MBean found for Worklight project?

I have a problem when deploying my Worklight project on the server . It shows the following Error Message :
FWLSE3041E: No MBean found for Worklight project 'MyProject'. Possibly the Worklight runtime web application for Worklight project 'MyProject' is not running. If it is running, use JConsole to inspect the available MBeans.
and when I tried to preview my application it showed this message :
SRVE0777E: Exception thrown by application class 'com.worklight.core.auth.impl.AuthenticationFilter.verifyServletInitialized:420'
I had the same issue using Worklight 6.2 CLI, but recreating the project did not work.
One issue that I had was that worklight did not build a .war-file properly, so I copied the .war-file from a backup.
Edit: This happens regularly in our project now, and we have no idea why. We fix it by invoking any procedure, which makes it work until you restart the server. Worklight must be building something when invoking a procedure that it does not do when building.
I Solved The problem by creating a new Worklight Project and copied all my files , it works just fine :) I used Worklight 6.1 instead of 6.2
I solved this by fixing a recently created security test in
server/conf/authenticationConfig.xml
The problem was I mispelled the Realm name I previously defined.
I solved this problem by deleting the application from the worklight server and rebuild it.
Delete WorklightServerConfig folder in workspace and rebuild your application.
I was able to fix this in MobileFirst 7.0 (Fka Worklight) by opening the Servers view, Window -> Show View -> Servers. Then expanding the MobileFirst Development Server and right click on the project in question, chose delete.
Once you do that go back to the applications' directory in the "apps" directory and right click -> Run As -> Run On MobileFirst Development Server
This should rebuild and deploy the project on the server.
I solved the problem by using ibm jdk not open jdk. My solution is to make sure the env parameters are correct
export JAVA_HOME = $your_ibm_jdk
export PATH + $your_ibm_jdk/bin:$PATH
run java -version to make sure the setting work

Error migrating Worklight 5.0.6 project to 6.1

I am receiving an error trying to upgrade my Worklight project from v5.0.6 to v6.1. I have done all of the pre-migration steps, including removing Tealeaf libraries from the project and adding the new analytics settings to the initOptions.js file.
During the migration, it fails in the step where it is trying to add Worklight Analytics properties to the Worklight properties file. I am getting the following error:
Migrator class com.worklight.upgrader.upgraders.ios.AppAddAnalyticsIPhonePlistXMLUpgrader has failed
Migrating the bcbst_mma_app_wl project from version 5.0.6 to version 6.1.0.0 has failed because Failed reading bcbstmmaappwlMmaIphone-Info.plist
I am not sure what is causing the issue. I thought it may be file permissions since I am using a copy of the actual 5.0.6 project, but the permissions look fine. I have been able to "successfully" migrate the project before by removing that plist file before the upgrade, but the upgrade complained that the file was missing, and it never really worked correctly.
I am using the Consumer edition of Worklight, in case that makes any difference.
EDIT I got the migration to work. I did a chmod 777 on all of the files in the directory and it worked. Not an ideal solution, but it worked. Thanks to #mikerott for pointing me in the right direction.
Are you using a Mac? Often importing projects with the "copy into workspace" checkbox checked will result in files being placed with the Mac "locked" file permission bit set.
Please find the bcbstmmaappwlMmaIphone-Info.plist file in Finder, right-click -> Get Info. See if the "Locked" checkbox is checked. If so, uncheck it and see if you encounter the same problem.
You may have to do this with multiple files.

IBM Worklight 6.0 - Dojo library uses localhost after deploy

I have a Worklight 6.0 project that uses the new Dojo 1.9 libs, I created an external dojo project, like the documentation suggested, then, in the main project properties, under "Dojo toolkit", it references this dojo19 project.
The project works on the local server, then I did "Run As" | "Build for Remote Server...", and entered the correct domain:port and context path, clicked Build, the *.wlapp files were updated. (I've also updated the settings for publicWorkLightHostname / publicWorkLightPort / publicWorkLightProtocol in the "Environment Entries for Web Modules" in the installed war to match the remote server names/port/protocol.)
But, after deploying both war and -all.wlapp file, accessing the app I get JS errors when it tries to refer to the dojo19 library:
The page at
https://<myIP>:9443/<myproject>/apps/services/www/ /mobilewebapp/default/IODMobile.html
ran insecure content from http://localhost:64441/dojo19/<myproject>/IODMobile/mobilewebapp/dojo/nls/core-web-layer_en-us.js.
The dojo19 is the project name in my Worklight developer workspace that I referred to above.
Why is it trying localhost? Seems there's a missing step here in deploying the dojo library project into Worklight.
Where are you trying to preview the application when you get the error message?
See the changes in Dojo in Worklight 6.0
If launching the application in emulator/simulator/device, see Billy Rowe's answer in this question
Partial copy/paste:
Step 1: Verify your application works in the Mobile Browser Simulator
with Provide Library Resources checked. If the Console log is showing
resources being served from the server, then these have to be copied
to your application before deploying to AVD or a device
Step 2: After you think you have all Dojo/resources within your
project, uncheck Provide Library Resources and test it again in MBS.
If it fails in MBS, then something is missing in your application that
is in the library/server. You can check Provide Library Resources and
retest to see if it shows you what that is. Not all resources are
shown, e.g. if there's a missing CSS file.
Also I would suggest to do all of this in the Development environment (that is, in Eclipse) before starting to deploy the .war file and .wlapp file etc... (which, BTW, I hope you're doing based on the new instructions for Worklight 6.0)
In the information center, it will show you how to uncheck the Provide Library Resources in the Console Log.
I think what you're running into is:
1) Something is being served from the Dojo Library/Server
2) A bug in 6.0 that used "localhost" instead of the IP of the host (your machine running eclipse). This is fixed in the 6.0 iFix. With this fix, you can run your app external to Studio and still use the Dojo Library/Server. Without this fix, you must have everything you need within your app.
Can you install the iFix and let us know if that fixed the problem?