Search code examples
androidibm-mobilefirstmobilefirst-server

How to move Android Studio native app to different MobileFirst server?


I use MFP CLI 7.1 and native Android Studio app. I've started local development server (127.0.0.1) using CLI. I've succeed with app connection to this server.

I'm trying to redeploy app to the remote Tst MFP server (192.168.1.117). This server was started from CLI as well.

I've run mfp push from the app Android Studio project. It completed successfully. I could see native API application in Tst server Operations Console and wlclient.properties has new I.P. and runtime application.

I'm getting following error in logcat for WLClient.connect operation:

D/wl.request: WLRequestSender.run in WLRequestSender.java:40 :: Sending request http://192.168.1.117:10080/tstMFP/apps/services/api/com_example_timurmarkunin_mfpstart/Androidnative/init
D/com.worklight.nativeandroid.common.WLUtils: WLUtils.convertStringToJSON in WLUtils.java:437 :: Input string does not contain brackets, or input string is invalid. The string is: Error 500: FWLSE0304E: Unhandled exception caught: null [project tstMFP]
D/wl.failResponse: WLFailResponse.parseErrorFromResponse in WLFailResponse.java:100 :: Additional error information is not available for the current response and response text is: Error 500: FWLSE0304E: Unhandled exception caught: null [project tstMFP]

Any ideas?

Thanks in advance.


Solution

  • In order to have an application connect to a different MobileFirst Server, you need to:

    1. mfp server add - and provide the remote server's protocol, ip/host, port, admin username/password and adminservices context root (typically the default one)
    2. mfp push given-new-server-name-from-step-1

    This will ensure that when pushing the wlapp to the remote server in step 2, it will also update the wlclient.properties in the native project, to use the remote server's IP address.

    I have tried this myself with the existing InvokingAdapterProcedures project in MobileFirst Platform Foundation 7.1.