0
votes

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,

  1. Clean the project
  2. Restart the server
  3. 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.

3
What is your MFP version?Sami
@HussamEddin Its MFP 7.1ChandrasekarG
if you are making the test in your eclipse, every time you make a change to worklight.properties, you must right click on your project and choose "Build Project" so the MFP will re-deploy the WAR file.Sami

3 Answers

1
votes

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.

  1. Stop Worklight Server.
  2. Remove your project from Mobile First Development Server.
  3. Go to the "bin" directory and remove your project war.
  4. Clean and Build the entire workspace.
  5. Start the server
  6. Deploy the adapters
  7. Run your app.
1
votes

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.

0
votes

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.