MobileFirst CLI 7.1 push on remote server - ibm-mobilefirst

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.

Related

The server was unable to process the request from the application. Please try again later

I have an Application developed in Worklight 6.1 and I upgraded the application to Mobile first 7.1. I have build and deployed the application in Mobile first 7.1.
But my application Not able to invoke the adapter and displayed the Message "The server was unable to process the request from the application. Please try again later"
I have followed the below procedure for up gradation.
1. Installed the Mobile first 7.1 Plugin in Eclipse
2. Imported the Existing 6.1 project in to My work space(I hope Tool will
auto upgrade app to 7.1)
3. Build the application and it generated .war, .wlapp and .adapter files
4. we have installed the standalone 7.1 Server.
5. Deployed the build files in servers.
6. Created the apk and installed in Mobile.
Now it is showing the Message "The server was unable to process the request from the application. Please try again later" while launching the application.
From the logs i found the below details when i try to invoke adapter
invocationContext: null
Status : 404
invocationResult : undefined
Note: It was working well in development environment
Kindly suggest
It'd be more useful to see the complete server and client logs as well. Please upload and edit the question with links to the log files.
That said, in step 6 (Created the apk and installed in Mobile.) you do not mention if you have re-built the project with the correct remote server host, port and context root values. Make sure you've done that. See The Build Settings and Deploy Target command.

How to minify MobileFirst hybrid iOS project?

I would like to obfuscate my code. The tutorial is under Concatenation and minification topic
These are the steps I’ve used to minify the code in hybrid app:
export JAVA_HOME=$(/usr/libexec/java_home)
cd /Users/keatooon/Desktop/testmfpminify2
mfp create testProject
cd testProject
mfp add hybrid testApp
mfp start
mfp build
mfp push
mfp console
mfp push —concatenate —minify
xxx:testProject xxx$ mfp push --concatenate --minify
Preparing for push...
Verifying Server Configuration...
Runtime 'testProject' will be used to push the project into.
Pushing to Server...
Deploying
/Users/xxx/Desktop/wktestmfp2/testProject/bin/testApp-common.wlapp...
Deploy complete for
/Users/xxx/Desktop/wktestmfp2/testProject/bin/testApp-common.wlapp.
/Users/xxx/Desktop/wktestmfp2/testProject/bin/testApp-common.wlapp
has been deployed.
Push Completed Successfully.
However, it does not add any security to the code.
Code before vs after Concatenation and minification:
Moreover, the code doesn’t work at all after concatenating and minifying it.
Without specifying which files you want to minify, done in the build-settings.xml file located in the root folder of your application, nothing would actually get concatenated and/or minified.
The fact that it fails the app from running is interesting...
Have you edited said file? If not, try to.
Find more information about concatenation and minification, here:
Updating the build-settings.xml file: http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/dev/c_optimize_app_cli.html
Configuring the build-settings.xml file: http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.reference.doc/cli_commands/build_config.html

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

Building iOS hybrid app does not update worklight.plist or root.plist file

I'm running WL 6.1 (6.1.0.01.20140310-1427) on a macbook air (latest OSX). I have a dojo hybrid application that I'm trying to connect to a remote WL server. When I generate an iOS app and I'm changing the address of the worklight server to a remote server. It does not change the address in the generated iOS code. The steps I follow are:
Open the Build Settings and Deploy Target... On the hybrid app folder.
Select the check box for Build the application to work with a different Worklight server.
Put in the new server information and click OK
Build all environments
After the build is complete, I launch into xcode and look at the worklight.plist and Root.plist files.
At this point they are still referencing my local server. If I edit them to point to the remote server, then my app works. Since these files are regenerated every time you do a build this is not a valid solution.
To verify it is nothing in my app, I created a default dojo hybrid application. Performed the steps I listed above. When I launched into xcode, the Root.plist and worklight.plist still have the default local server information.
So here is the funny thing. I also have a win7 system running the same level of WL developer plugin. I perform the same steps and the worklight.plist file is updated correctly on windows, just not in osx. The only other difference is the win7 version is running jre 1.7_21 where the osx is running 1.7_51. Both are in 64-bit mode.
I believe the real difference between your Mac and Windows machines is step 5, where you "launch into xcode". If by that you mean that you are actually doing Run As > Xcode project, then see below. This option is available only in Mac and not in Windows.
This is the expected behavior in Worklight 6.0.0.x and 6.1.0.x.
If after changing the server address to a remote server (rather than the local development server) and building, and then selecting Run As > Xcode project, this will overwrite the server settings back to the local development server.
Run As > Xcode project does 3 actions:
Build & deploy the app to the local Worklight Development Server
Generate an Xcode project (this in turn overwrites worklight.plist back to use local server settings)
Open the generated Xcode project in Xcode
So if you want to use the app with the remote server settings, then after changing the settings and build the app, either:
Copy the .zip from the your-iphone\package folder
Navigate in the filesystem to the iphone\native folder and double-click the .xcodeproj file to open the it straight in Xcode (like what Run As > Xcode project does)
For future releases of Worklight it is being considered to streamline the behavior so that no matter if you choose, local or remote server settings, Run As > Xcode project will always use the ones you've selected.

IBM Worklight - JSONStore is not working when trying to push the data to back end server

We are trying to push the data from IBM worklight application using JSONStore functionality.
We are working on IBM Worklight V5.0.6 environment.
Steps to reproduce:
Open Worklight 5.0.6 studio
import
'module_07_11_JSONStore_with_Sync' project into workspace
Accept
to migrate the project to latest Worklight version
Build & deploy
the app to Worklight server
Try to create JSONStore
At this stage we are getting the error:
JsonStoreWizard.InvokeProcedurePage got exception invoking adapter
Because of this, we are not able to create a new JSONStore instance.
What is the reason for getting this error?
After:
Accept to migrate the project to latest Worklight version
Expand the adapters folder > Right Click on the user folder > Select deploy Worklight Adapter and check it was deployed correctly in the console.
You may want to test the adapter in isolation too. "Invoke Adapter Procedure" from Eclipse.
There's no need to use the JSONStore Wizard to work with that sample, if I recall correctly. Just deploy the adapter, build all and deploy the app, open the Android or iPhone Worklight Application, play with the UI and read the source code.
I also recommend reading the JSONStore documentation especially the part under Adapter. Take a look at: WL.JSONStore, init, push, load and count. The examples should help you get data and push it back to your adapter.
If you run into issues, this StackOverflow answer can help you debug and provide more information if you ask JSONStore questions.
What is the reason for getting this error?
The JsonStoreWizard.InvokeProcedurePage error seems to indicate invoking the adapter failed. Leave a comment if you're still unable to push data back and I'll probably update this answer.