Saturday, August 23, 2014

How to configure Java Mission Control


Java Mission Control (JMC) is a tool that runs on Oracle JDK to perform Java monitoring, profiling and Java Application performance in both development and production environments. With this tool we can diagnose ADF application for any possible memory leaks, stuck threads or identify slowness of the application.
The JMX Console is used for monitoring and managing a running JVM instance.
Java Flight Recorder (JFR) is inbuilt in JMC and it produces detailed recordings about the running application. Once the recording is done, we can analyze it offline. The recording data include Memory and CPU usage statistics, Heap Statistics, Thread Dumps, Garbage collection Statistics, Object allocations, events etc.
JMC is included in JDK Package, It can be found in JAVA_HOME location.
E.g. C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\bin

You can run the tool directly from there or through command line or by adding it JDeveloper as External Tool.


Staring Weblogic with Flight Recording Enabled
You need to start Weblogic server using flight recording enabled, for the JMC flight Recorder to work.
To do that follow below steps
·       Right click viewcontroller and go to project properties à Run/Debug à Edit the default profile configuration (or your profile configuration).
·       Paste the following lines in Java Options
-XX:+UnlockCommercialFeatures -XX:+FlightRecorder




 ·        Restart the server and run your application.
Using JMC
·        Open Java Mission control (JMC) after starting your application.


·        You can see Weblogic server running in JVM Browser Tab.
Optional Step:
If you are using a remote agent (This step is optional if you are running application locally)
·        Add the following parameters for Project properties / as VM arguments for running server
        -Dcom.sun.management.jmxremote=true
        -Dcom.sun.management.jmxremote.port=7091
        -Dcom.sun.management.jmxremote.authenticate=false
        -Dcom.sun.management.jmxremote.ssl=false
·        You can add/enable a remote agent using “Create New Custom JVM Connection “link


 ·        Right click on Weblogic and select à Start JMX console

·        In JMX Console you can see the live CPU, Memory usage in Graph , also there are tabs at the bottom to see detailed thread and memory usage.





q
Flight Recorder – recording data

·        Right click on Weblogic server and select “Start Flight Recording”. 
·        In Create flight recording dialog, choose name, and Recording time. Click finish to start flight recording

·        You can check Flight recorder by expanding Weblogic server à Flight Recorder. Also can stop and dump or edit the recording while it is in progress
·        Once recording is done, JMC opens the recording automatically or open it manually from location you choose to save or from default location (C:\Users\<user>\.jmc\5.3.0\).

·        Now you can analyze the data to find the problems

Analyzing a sample application:
·        Image below shows that High Memory Usage and Full Garbage collection was running sometimes, at that point application slows down and even freezes. 

·       Below Data shows there are 2 stuck threads and are running with high percentage and pointing to a method in the code.

·        Other Example Data

Check the below links for information and tutorials about how to analyze the JMC Flight recording.
·       Java Mission Control and Flight Recorder Demo Series http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/mc-jfr/index.html



More Information:

Monday, August 11, 2014

How to Configure Jdeveloper to Launch in various roles?


Below is the screen shot to know how to configure Jdeveloper to launch in different roles,

Customization Developer - If you want to launch the jdeveloper to customize out of box features, then launch the Jdeveloper in this mode.


Friday, July 18, 2014

How to unlock specific User in Oracle Database


Make sure you have installed Oracle Database already installed on your machine. For individual development purpose, Oracle has Express Edition light weight database s/w, that you can download and install on your machine.

- Connect to SQL Command Line prompt
    Start -> All Programs ->  Oracle Database <Version> Edition -> Expand -> SQL Command Line

-  Execute below command
                     SQL> connect / as sysdba

- You should notice as below

- Execute Below commands
          ALTER USER HR IDENTIFIED BY HR;
          ALTER USER HR ACCOUNT UNLOCK;


Tuesday, July 15, 2014

Unable to obtain credential store using jps-config



If you notice below error in your Jdeveloper, follow below solution to resolve.

Unable to obtain credential store using jps-config



Solution : Take backup of 'cwallet.sso' and delete this file from /Application/src/META-INF/

Configuring OHS Server Configuration files


What is httpd.conf file ?

This is a server configuration file which typically contains directives that affect how the server runs, such as user and group IDs it should use, and location of other files. Because the server configuration file is the main file that the server starts with, Oracle HTTP Server does not include any directive that says where to locate it. The location is passed on command line when the server starts.

Location :
Example :
/<box_name>/admin/ohs_instances_fm042/config/OHS/ohs1

Follow below link for more information

http://docs.oracle.com/cd/B12037_01/server.101/b12255/conffile.htm

mod_wl_ohs.conf : This file contains all the EM/CS related entries

http://docs.oracle.com/cd/E29542_01/webcenter.1111/e27738/wcadm_documents.htm#WCADM10693

Wednesday, July 2, 2014

Error: An unreported error occurred in Appc. No errors were reported, but the tool returned a failure result code: 1.



If you encounter below error while running your ADF app locally, add below code in web.xml just before </web-app> and it should resolve this compilation error.


Error: An unreported error occurred in Appc. No errors were reported, but the tool returned a failure result code: 1.

 <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsff</url-pattern>
            <is-xml>true</is-xml>
        </jsp-property-group>
    </jsp-config>