Worklight.home environment variable not getting set - ibm-mobilefirst

We installed the Worklight v6.1 Server on Tomcat. We now have an issue deploying the wlapp application file from the Worklight Console. I'm 80% sure this problem has to do with permissions. The error, when trying to deploy the wlapp, is:
Worklight adapters will fail to deploy because directory '/worklight.home/worklight/data/export/adapters' could not be created. Restart the Worklight Server after fixing the problem. [project worklight]
The issue is that worklight.home isn't a physical directory, but should be an environment variable. We don't know the value of that environment variable or where it gets set.

The worklight server first try to build the adapter folder based on "javax.servlet.context.tempdir" property, that's mean the application server temp directory.
If that does not work,then the worklight server try to use System.getProperty("user.dir") + "/worklight.home/" + servletContext.getContextPath().
You can try setting the user.dir property if is not set yet.

Related

Is there a way to clear IBM MobileFirst Platform server Cache?

I'm working on an IBM MobileFirst Platform 7.1 project where there are many name value pairs in the worklight.properties file.
Say for example,
HOST_NAME = www.google.com
I access these variables form the MobileFirst adapter.
var hostName = WL.Server.configuration["HOST_NAME"]
There will be cases where I'll have to change the HOST_NAME in the worklight.properties to a different value. But sometimes, even after the value is changed in the worklight.properties file, they are not getting updated in the adapter.
Every time when I change the values I do the following,
Clean the project
Restart the server
Deploy the adapter again
Nothing seemed to change the value.
I suspect, the MobileFirst server caches the values and reuses the old values without updating the new ones. I say this because, I tried deleting the values in the worklight.properties file, and even tried deleting the file itself. Still the adapter was using the old value.
I tried deleting the MobileFirstServerConfig Folder in my workspace. Even that didn't work.
It would be great if someone could help me clear the cache or find a work around to this issue. Thanks in advance.
I kind of followed the above method but initially it didn't work.
But later I tried to follow these steps in this exact order and it seemed to work.
Stop Worklight Server.
Remove your project from Mobile First Development Server.
Go to the "bin" directory and remove your project war.
Clean and Build the entire workspace.
Start the server
Deploy the adapters
Run your app.
The worklight.properties file is embedded into the project runtime WAR file. So, if you change anything in worklight.properties, you must rebuild the WAR file and redeploy it. Based on your description, it sounds like you're only building the adapter (and not the app). At minimum, I would suggest to remove the runtime WAR file from the project "bin" directory (just to ensure that it gets rebuilt) and build all app environments. That should build / redeploy the WAR file and restart the server, and then what you're doing should work.
Here are the steps to follow:
1. If worklight server is up and running, stop it or restart your system.
2. Clear bin folder.
3. Do Clean Project and Build for enviournment.
4. Open Mobile first Console(Start server)
5. Deploy All adapters
6. Run your app.
If wlq or wl error is comming we can give an alert message 'test' in our main file where we have all the javascript files.

MobileFirst CLI 7.1 push on remote server

I try to push .wlapp to a remote server with the following command.
mfp push rockW510_Local mprod
And i have the following error
Preparing for push...
Error: error code: 306
Error: The runtime being pushed to [mprod] is not the same as the application's >runtime [StarterApplication_ionic-release71]
Error: INVALIDRUNTIMESCENARIO
Error: Push has failed
Is it not possible to push .wlapp, .adapter on a remote server with a different runtime of the local projet ?
Thanks
Update:
The official word is as following:
This behavior is by design. That runtime check was put in place to
ensure MFP project based apps were only deployed to the associated
project's runtime.
Cordova apps created outside of a MFP project can be deployed to any
runtime.
I was able to recreate this the following way:
Created a local server with a project "myproject", added a Hybrid app and mfp pushed it to create the .wlapp file
Create a server config for the remote server I have
Ran the command: mfp push server2 myproject2
It failed with the same error.
I then:
Loaded the console of server2
Dropped the .wlapp file
The .wlapp file successfully got deployed
So I guess that something in mfp push is failing in this scenario. Or it could be the expected behavior... need to double-check this (in progress...)
In the meanwhile you have the above workaround.

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

Worklight Development server not starting up

I am currently working with IBM Worklight and came up with this trouble. Everything worked perfectly and suddenly I was updating my Android ADT and then out of nowhere, my worklight server got turned off and It doesn't start up. I searched through the site and could not come up with questions addressing the exact problem.
When I click on the start server, I get the following log info.
Listening for transport dt_socket at address: 10777
Launching worklight (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130524-0951) on Java HotSpot(TM) Client VM, version 1.7.0_51-b13 (en_US)
[AUDIT ] CWWKE0001I: The server worklight has been launched.
[AUDIT ] CWWKG0010I: The server worklight is shutting down because of a previous initialization error.
[AUDIT ] CWWKE0036I: The server worklight stopped after 8.827 seconds.
And a popup box which says
Server Worklight Development Server failed to start.
Here is what my screen looks like..
Kindly help me guys
Thanks
From the Servers view, delete "Worklight Development Server"
Restart Eclipse
The development server should be automatically re-generated
See if starting it now works.
Per the comments:
Without having the original project to recreate the (new) migration issue, my only solution is to create a new project and copy the web resources to it.
I got similar errors that the upgrade from 6.1.0.0 to 6.1.0.1 failed after updating from eclipse. I deleted the project, recreated it, copied the common folder into it, recreated the environments (android and iphone). Then I was getting errors on both the iphone and andriod build about wlBuildResources/.../obscureArgs.txt not found. I deleted wlBuildResources and started eclipse with -clean. That seems to have at least gotten the project to build. Idan if you want to try this project upgrade/migration you can get it from: https://github.com/attdevsupport/ATT_APIPlatform_Worklight/tree/master/ATT_WL_InAppMessaging
I had a similar issue.
Under your root folder of the worklight project there would be a hidden file under .settings/org.eclipse.core.resources.prefs
Open the same with TextEdit or NotePad. Delete the line wl_version=6.1.0.0....... and save the file. Now try to open the project again it would get recreated with the latest version number.

IBM Worklight 6.0 - SRVE0777E: javax.servlet.ServletException: Worklight Project not initialized

I've just installed Worklight 6.0 on Mac OS X Mountain Lion 10.8.4.
I'm trying to build a very simple HelloWorklight app to test the installed environment and I'm getting errors building and deploying it.
I'm getting these errors in Eclipse console:
[2013-07-13 02:11:21] Starting build process: application
'HelloWorklightApp', all environments
[2013-07-13 02:11:21] Application 'HelloWorklightApp' with
all environments build finished.
[2013-07-13 02:11:21] Deploying application
'HelloWorklightApp' with all environments to Worklight Server...
[2013-07-13 02:11:21] Failed to deploy the application to
Worklight server: Worklight module
HelloWorklightProject was not
successfully started. Full details of the error are available from the
Worklight Development Server console.
The Worklight Development Server console in my browser shows:
Application Error
SRVE0777E: Exception thrown by application class
'com.worklight.core.auth.impl.AuthenticationFilter.doFilter:110'
javax.servlet.ServletException: Worklight Project not initialized
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
I'm truly stuck. On the other hand I'm sure it must be something simple to fix it.
Has anyone got an idea how?
I had a similar problem (at least WDS console error looks the same).
A little bit history:
My problems started, when I updated Worklight to version 6 (with version 5 I had no problems). Some compilation erros were fixed by adding Websphere Library to a project. But my custom authentication still wasn't working.
How I fixed it:
open new workspace in Eclipse
import Worklight project
clean project
restart Eclipse
downgrade compiler compliance level (in Eclipse: Window > Preferences > Compiler and set "Compiler compliance level" to lower version)
rebuild project and try to run it
At this point it started to work. I've spend lots of time to find out that compiler stuff, but still I'm not sure which part requires that.
So we had this issue with 2 macs and it took us a solid day and a half to figure it all out.
We went through a lot of reconfiguring, re-downloading eclipse and worklight.
Make sure your config files from the update are correct. (worklight.prop and authConfig)
This is the big one. Install JDK 1.7 and reference the new JRE 7. When we
were running on Oracle JRE 6, we had a ton of errors and even a Java
Heap memory issue.
Once you install it, it may to be tricky to find the actually path to the JRE.
First, go to Eclipse > Pref > Installed JRE's > Add
Then, add a new standard vm. Click Directory on the next pane and browse to the install path of JRE.
We found it in [name of your HD] > Library > Java > JavaVirtualMachines > jdk1.7.0_25.jdk > Contents > Home > jre
It should load everything it needs and you can click the check box of the new JRE. For good measure, I changed the compiler to 1.7 as well.
The jdk folder may have a slightly diff name depending on what update you have. Hopefully this helps.
I got the same error after deploy an new app deployment.
What I've done on Server is:
delete all application
delete all extra configuration between new server instance and my current instance. In my case it was: applicationMonitor and shared librairy
clean
restart
After that I managed to deploy my application normally
window -> show view -> servers -> server configuration -> HTTP EndPoint -> host
By default the host will be *. Try to change the host as your local machine ip address. for example host = . After changing the host, close the server.xml and then try to rebuild the project.