Wednesday, February 05, 2014

JRockit and Sun JDK with WebLogic Server

Difference Between JVM,JDK,JRE
**********************************************************************************
JVM is Java Virtual Machine -- the JVM actually runs Java bytecode.
JDK is Java Developer Kit -- the JDK is what you need to compile Java source code
    JDK = JRE + JVM
In other words JDK is grandfather JRE is father and JVM is their son
JRE is Java Runtime Environment -- is what you need to run a java program -- it contains a JVM, among other things.
JRE is targeted for execution of Java files
i.e. JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime libraries

OpenJDK is an open-source version of the JDK, unlike the common JDK owned by Oracle

**********************************************************************************
Difference Between JRockit and Sun JDK with WebLogic Server

Looking at the start scripts $DOMAIN_HOME/bin/setDomainEnv.cmd, I just realized that this operational task is basically taken care of in the scripts we have.

To swap between the Sun JDK and JRockit to launch a WLS instance, all you need to do is set the JAVA_VENDOR environment variable to either "Sun" or "Oracle" and the scripts will take of launching WLS using the specified JDK.

Snippets from setDomainEnv.cmd:
set BEA_JAVA_HOME=d:\wls1031\jrockit_160_05_R27.6.2-20
set SUN_JAVA_HOME=d:\wls1031\jdk160_11

if "%JAVA_VENDOR%"=="Oracle" (
set JAVA_HOME=%BEA_JAVA_HOME%
) else (
if "%JAVA_VENDOR%"=="Sun" (
set JAVA_HOME=%SUN_JAVA_HOME%
) else (
set JAVA_VENDOR=Sun
set JAVA_HOME=d:\wls1031\jdk160_11
)
)




Where JAVA_HOME is then used by startWebLogic.cmd script when it launches the WLS instance to identify the JDK to use.

Snippets from startWebLogic.cmd
%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% 
-Dweblogic.Name=%SERVER_NAME% 
-Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy 
%JAVA_OPTIONS% 
%PROXY_SETTINGS% 
%SERVER_CLASS%



With this information at hand, then switching between the two different JDKs is as simple as setting an environment variable before launching WebLogic Server


Using JRockit:
>set JAVA_VENDOR=Oracle
>startWebLogic.cmd
...
d:\wls1031\JROCKI~1.2-2\bin\java -jrockit -Xms512m -Xmx512m -Dweblogic.Name=AdminServer ...

And just as easy to switch back to Sun. Note here that you could just unset the JAVA_HOME environment variable, which will set the script to use whatever default was configured when the domain was created.

Using Sun JDK:
>set JAVA_VENDOR=Sun
>startWebLogic.cmd
...
d:\wls1031\JDK160~1\bin\java -client -Xms256m -Xmx512m -Dweblogic.Name=AdminServer ...

Tuesday, February 04, 2014

Heap dump in weblogic and Jboss

How to take Heap dump in weblogic applications:

if App is using jrockit version:

Please go to the application Jrocket Bin Directory to generate Heap Dump:

cd /prod/appl/bea/home10.3/jrockit_160_51/bin/

 Application Name:Digitalworld

(for digitalworld application) or you can get this path information if you grep the process.

Ps -ef |grep digitalworld

digitalworld 22041 10324  1 01:05 ?        00:05:36 /prod/appl/bea/home10.3/jrockit_160_37/bin/java -server -DdigitalworldAdmin -Xms512m -Xmx512m -classpath

here you get the  PID to generate the Heap Dump.

Syntax:


./jrcmd PID hprofdump filename=Path (where you want to generate the file)


Example

./jrcmd 22041 hprofdump filename=/prod/ecom2/local/apps/apps10/digitalworld/current/logs/archive/heapdump.log