April 8, 2015

Run Android Apps on your Mac or PC

Do you have Chrome on your Mac or PC? Then you can run android apps on your Mac or PC.
Google has come up with App Runtime for Chrome (ARC).

Pre-requisites:
  • You need Chrome browser for sure to start with it
  • apk file of the app  you wanted to install 

Procedure:

      Below is the procedure to setup and install the apk file.
  • Install the "ARC Welder" extension on the chrome. Click here to install it.
  • After installation is done, you can see an icon with the label ARC Welder on the chrome apps tray 

  • Click on the icon. A new window will be opened as shown below

  • Click on "Add your APK" and choose the path of your apk file
  • It will show the window like below

  • Choose the orientation, form factor and click on the button LaunchApp
  • Now the app will be launched in a new window
  • You can also download the chrome package for the app by clicking the button DownloadZip on the above screen

References:

April 4, 2015

javax.net.ssl.SSLKeyException: failed hostname verification

Problem:
When my adf web application executing a web service call, I got the below error which was failed to verify the hostname.

javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: [Security:090504]Certificate chain received from XXXXXXXXXXXX.demos.com - YY.YY.YY.YY failed hostname verification check. Certificate contained *.demos.com but check expected XXXXXXXXXXXX.demos.com


where XXXXXXXXXXXX.demos.com is my host name.

Solution:

To avoid this error, we have two solutions. One is to make weblogic ignore the host name verification and another one is to ignore verification through code. We can use either of these solutions to avoid the above error.

The first way is the weblogic should ignore the host name verification. To do this, follow the below procedure.

  • Login to weblogic console
  • Go to Servers, then click on the server name (in my case the name is DefaultServer)
  • Go to SSL tab
  • Under the Advanced section, you can see the property "Hostname Verification"
  • By default, it value is "BEA Hostname Verifier". Change this value to "None"
  • Click on Save and restart the server
  • Run again the application now

And the Second way is to write a code snippet to ignore verification of host name. Below is the java code to do so.
     
TrustManager[] trustAllCerts =
            new TrustManager[] { new X509TrustManager() {
                public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                    return null;
                }

                public void checkClientTrusted(java.security.cert.X509Certificate[] certs,
                                               String authType) {
                }

                public void checkServerTrusted(java.security.cert.X509Certificate[] certs,
                                               String authType) {
                }
            } };

        SSLContext sc = SSLContext.getInstance("SSL");
        sc.init(null, trustAllCerts, new java.security.SecureRandom());
        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

        // Create all-trusting host name verifier
        HostnameVerifier allHostsValid = new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                System.out.println("HostnameVerifier - "+hostname+" Session: "+session);
                return true;
            }
        };
        HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);


Note: These two ways are only for testing purpose, may not suggestible to use in production environment.

April 3, 2015

oracle.security.jps.JpsRuntimeException: Cannot read from policy store

Problem:
While running my integrated weblogic, I got an error like below.

oracle.security.jps.JpsRuntimeException: Cannot read from policy store. Reason is PolicyStore Error, javax.xml.stream.XMLStreamException: Error at line:332 col:25  ' '

Solution:
To solve this error, the weblogic domain should be deleted and start the weblogic again. Then it will create a fresh domain.