Friday, August 22, 2014

Oracle MAF - Issues, Tips and Tricks

Hi All,

I have built a mobile application using Mobile Application Framework released in July 2014.
In the mobile app I have done integration using REST services with JSON output. And the user will fill some forms and will send attachments from camera and library. The user can see history and I have used a pie chart as well for historical data.

Here is some of the issues, tricks which I learnt and I am sharing the same:




[11:29:47 AM] Checking state of Android Debug Bridge server...
[11:29:47 AM] Android Debug Bridge server already running.
[11:29:55 AM] Command-line executed: ["C:\Program Files\Android\android-sdk\platform-tools\adb", start-server]
[11:29:55 AM] ADB server didn't ACK
[11:29:55 AM] * failed to start daemon *
[11:29:55 AM] * daemon not running. starting it now on port 5037 *
[11:29:55 AM] Command-line execution failed (Return code: -1)
[11:29:55 AM] Deployment cancelled.

Go to platform-tools and kill adb server, it might be running because you would have done some debugging.
cd C:\Program Files\Android\android-sdk\platform-tools
adb kill-server


Error while deploying MAF app to android:
[12:11:31 PM] Cannot run program "xxx\adt-bundle-windows-x86_64-20140321\sdk\tools\zipalign"": CreateProcess error=2, The system cannot find the file specified
[12:11:31 PM] CreateProcess error=2, The system cannot find the file specified

In case, if you hit the above error while deploying MAF application to android device, here is the reason:

When generating an deployable artifact(apk), JDeveloper uses zipalign.exe that comes with ADT. This used to be located in /sdk/tools, but (with latest ADT release) it is now located in /sdk/build-tools/ folder. A quick work around (till the fix is available in Jdev) for the above issue is to copy the appropriate  zipalign.exe to /sdk/tools folder.

If zipalign is not available, that means you have upgraded your tools but you have not upgraded your build-tools, do that from SDK Manager.

3. ( MAF Application Hangs / Stuck at Splash screen showing Oracle logo )
The application is hanging after successful deployment and you are only seeing the splash screen.
a. Welll check, if you missed changing back java.debug to false
b. You are calling webservices and you missed selecting the checkbox for "Network" in maf-applications.xml -> Permissions
c. MAF only supports XML encoded in the ASCII, UTF-8 or UTF-16 character sets.  JDeveloper might default this based on your machine`s setting and uses it to encode the XML files in your MAF application.
Change the character encoding option in Project Properties for your project:

d. If the above don`t resolve your issue then deploy your application in debug mode and open monitor.bat(location -> tools directory under android folder) and see what exception is coming.

When seeing the logs in monitor I am getting the following message multiple times and because of that its diffcult to find the required logs:
07-23 05:43:50.796: W/Trace(3095): Unexpected value from nativeGetEnabledTags: 0

Goto your Logcat
As a workaround I'm filtering the LogCat output with the following expression on the by Log Message field of the filter:


5. ( Webservice Certification Error )

When calling a secured webservice I am getting the following error:
Certificate was issued by an unrecognized entity

Download certificate using firefox, available in details tab when we access the site.

ADF Mobile will only recognize certificates from a few popular CA signing authorities.

Following the below link and register your certificate with JVM:

First copy cacerts file from your project to the bin directory, then run the below command and then copy back the cacerts file:
cacerts file location - \MobileApp\resources\security

cd C:\Program Files\Java\jdk1.7.0_60\bin
keytool -importcert -keystore cacerts -file adpc_cert -storepass changeit -noprompt


07-23 16:00:16.784: D/CVM(1243): [SEVERE - oracle.adfmf.framework - RestTransportLayer - readResponse] ERROR: REST Transport - read - ERROR [oracle.adfmf.framework.exception.AdfInvocationRuntimeException] - HTTP Status Code 500 Internal Server Error: The server encountered an unexpected condition which prevented it from fulfilling the request.
07-23 16:00:16.818: D/CVM(1243): ERROR [oracle.adfmf.framework.exception.AdfInvocationRuntimeException] - HTTP Status Code 500 Internal Server Error: The server encountered an unexpected condition which prevented it from fulfilling the request.
07-23 16:00:16.824: D/CVM(1243):  at Source)
07-23 16:00:16.824: D/CVM(1243):  at Source)
07-23 16:00:16.844: D/CVM(1243):  at Source)
07-23 16:00:16.844: D/CVM(1243):  at Source)

07-23 16:00:17.274: D/CVM(1243):         <title>Request format is unrecognized for URL unexpectedly ending in '/'.</title>

Make sure the REST URL which you are setting in your code doesn`t have / in the end.
7. ( Invalid Request Format when calling REST service )
Getting the below error while calling a REST service with json output using RESTServiceAdapter:
 System.InvalidOperationException: Request format is invalid: .
Can be multiple reasons. Make sure you specify the correct content-type and accept parameters:
        // Specify the type of request
        restServiceAdapter.addRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        restServiceAdapter.addRequestProperty("Accept", "application/json; charset=UTF-8");

The most important property for displaying an image is max-width:100%
Using this the image is fully displayed properly in specified or calculated region based on the screen size of the mobile.
9. ( Display multiple line in list view )
If you want to display multiline output text inside a listview use below attribute in inline style for outputText:

 Use severe logs during testing and your logs will be generated even in release mode.            Trace.log(Utility.ApplicationLogger, Level.SEVERE, LoginBean.class, "Calling Authentication Service",
                      "##############Payload:  " + payload);
This way you don`t need to deploy in debug mode for seeing the logs. But make sure to change back to INFO during production deployment.
Note: Release mode runs much faster than debug mode.
11. ( Open a URL programatically through Javascript )

You have a requirement to open a url from your mobile app in mobile browser programmatically. In that case you can call a javascript function and use the below code:
if(device.platform == 'Android') {, {openExternal:true});
  } else {, '_system');

12. Setting and Getting EL Value Programmatically

AdfmfJavaUtilities.setELValue("#{pageFlowScope.msg}", "Welcome");
String msg = (String)AdfmfJavaUtilities.evaluateELExpression("#{pageFlowScope.msg}");


13. Getting size of the iterator (estimatedrowcount or rowcount)

As suggested by Steven Davelaar in one of the discussion threa:
The AmxIteratorBinding class has a method getIterator which returns an instance of BasicIterator. This class has a method getTotalRowCount, so you can use the following expression:


See the javadoc for more info BasicIterator (Oracle Fusion Middleware Java API Reference for Oracle Mobile Application Framework
I will keep on updating this blog.



  1. How to navigate between 2 AMX pages with parameter and without parameter

  2. This comment has been removed by the author.

  3. Hey I am nerd in oracle MAF.
    Can you please tell me ,Is it possible to call feature from feature...and feature can contain whatever amx ,pageflow...etc.
    if yes can you please tell me the steps...

  4. Hi,
    I am new to Oracle MAF and trying to build myown applications. Could you please tell me how to create a hamgurger menu in MAF?

  5. Hi there, I'm running a mobile hybrid MAF application and in android/iOS i keep getting an issue where randomly page will load, show white screen and loading logo, but then never complete loading.

    Whenever I press the blank screen again though it will again start loading and complete loading. Do you know why this would occur?

  6. Hi there, i am new to MAF, I am building application which detects users current location i used StartLocationMonitor

    Target unreachable base expression 'locationBean' resolved to null

    please guide me on this issue

    thanks in advance