Manoj Official Blog
Wednesday, February 12, 2014
Wednesday, February 05, 2014
JRockit and Sun JDK with WebLogic Server
Difference Between JVM,JDK,JRE
**********************************************************************************
JDK = JRE + JVM
In other words JDK is grandfather JRE is father and JVM is their son
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:
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
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:
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:
**********************************************************************************
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
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
Friday, January 17, 2014
Service Mix 4.0 Overview
Defination of serviveMix in simple words:
Service Mix
is a Container which have a collection of webservices and routing components.
Srandard definition :
- Service Mix is a Enterprise Class ,Open Source, Light weight,Distributed Esb and SOA architecture Tool kit
- We can compare the Service Mix with a computer Mother board having all small components to plug and play.
- Main Components are : Karaf ,JBI,ESB,ACTIVE MQ,OSGI,JMS,SPRING……etc.
Main Services Provided By Service Mix:
1.JMS Integration : Active MQ
2.WebServices : JBI and NMR
3.Routing Engine : CAMEL, CFX and EIP’s
Service Mix fully supports of:
- OSGI Framework
- Embeded Spring Framework
We can use service Mix in:
- Java Standard Edition
- Java J2EE Edition
Service Mix uses ActiveMQ to Provide:
- Remoting
- Clustring
- Reliability
- Distributed Failover
Difference B/w ServiceMix3.0 and 4.x
Directory structure Of Service Mix:
The directory layout of a Karaf installation
is as follows:
·
/bin: startup scripts
·
/etc: configuration
files
·
/data: working
directory
o /cache:
OSGi framework bundle cache
o /generated-bundles:
temporary folder used by the deployer
·
/deploy:
hot deploy directory
·
/lib: contains the
bootstrap libraries
o /lib/ext:
directory for JRE extensions
o /lib/endorsed
:directory for endorsed libraries
·
/system:
OSGi bundles repository, laid out as a Maven 2 repository
ESB (Enterprise Service Bus)
An ESB is act as a backbone between two similar or different components through which the services flows Like :messaging , routing, transformig and Webservices
Minimum requirements of ESB message delivery
The minimum requirements of an ESB, as a message delivery system, are often referred to by the acronym TRANS,which defines an ESB as a software entity that does the following:
•Transforms messages from one format to another to accommodate the requirements of registered service providers
•Routes messages to registered services while providing quality-of-service and service-level features.
•Augments message content with information, such as additional metadata, about the message requester. Augments the message protocol to meet service provider requirements.
•Notifies registered message listeners about specific message requests.
•Secures delivery of messages by enforcing authentication, authorization, nonrepudiation, confidentiality, etc.
OSGi overview(OSGi bundle)
- OSGI: Open Source Gateway Initiative:
- It is also known as a dynamic module for java,
- We can deploy the bundles at runtime without bring down the components
- We can break our application into different parts or modules to reduce the dependencies.
- Technically OSGi bundles are .jar files with additional meta information. Osgi is basically used for Implementation and Deployments (Dev side only)
- Meta information is stored in the META-INF/MANIFEST.MF file.
Difference
between jarfiles and bundles
- There is basically no difference between jar and bundles
- Jarfiles contains invisible Javaclasses and libraries files i.e, they are private to other bundles.
- The manifest file requires OSGi metadata in its manifest so that an OSGi framework can manage the visibility of classes between bundles
- The key difference with OSGi is that a JAR is now all private, adding metadata in the manifest makes it a bundle that can safely share with other bundles.
- The Import-Package manifest header tells what packages should be made visible to the bundle, and the Export-Package defines the packages in the bundle that should be made visible to others. Other headers provide additional features.
Bundle-SymbolicName
and Version
The
name starts by convention with the reverse domain name of the bundle author,
e.g. if you own the "example.com" domain then the symbolic name would
start with "com.example".The Bundle-Version and the Bundle-SymbolicName uniquely identifies a bundle in OSGi.
Both
properties are defined in the META-INF/MANIFEST.MF file.
Bundle-LifeCycle:
With the installation of a bundle
in the OSGi runtime the bundle is persisted in a local bundle cache. The OSGi
runtime then tries to resolve all dependencies of the bundle.
If all required dependencies are
resolved, the bundle is in the RESOLVED status otherwise it is in theINSTALLED status
If the bundle is started, its status is STARTING. Afterwards it gets the ACTIVE status
JBI Overview ( Java Business Integration)
JBI provides an environment into
which components can be plugged in. In this environment, the components
collaborate by exchanging information in order to accomplish some tasks. The
information is exchanged using a message exchange model according to the web service
description language (WSDL) 2.0 or 1.1.
NMR(Normalised Messaging Routing)
The key concept that stands behind JBI is that the components don't exchange messages directly but instead use an internal component that is part of the JBI environment called Normalized Message Router or simply NMR.
A
normalized message is built by three different
parts:
- The Bare Message: An XML document following the
WDSL abstract message specification
- The Metadata: Extra data associated to the
message used by the JBI environment to route messages
- The Attachments
Service assemblies (SAs) and service units (SUs)
Service Unit: is a normal JAR file which consists of a configuration file, for ServiceMix this is a XBean configuration and optionally classes and libaries. A service unit is always configured for one service engine or binding component.S o we have separate service units for JMS, File and routing configurations. Therefore we need a service assembly,
Service Assembly:that consists of all the service units (JAR files) for one integration solution. A service assembly is JAR file consisting of a jbi.xml configuration file and the service unit JARs. An example of a XBean configuration for a JMS binding component is:
In simple
words
Service
Unit is a normal jarfiles which consisting of xmlfiles under METAINF dir and
these jar files having dependencies
service
Assembly: it contains one service unit and one extra XML file depending upon the project
If it is
bean then jbi.xl
If it is
maven the it is pom.xml
Camel Overview
Camel: It
allows XML and Java scala-DSL-based format to express our routes there are all
over 70 optional components for expressing routing
Deployment
and installing additional components
Deployment
Routes in {plain blue print.xml, Plain spring XML file}
Deployment
Routes in {OSGIBundle containing plain blueprint.xml and OSGIbundles containing
plain spring.XML files}
1.
There are two Message Endpoints one for
FTP connectivity and another for HTTP.
2.
Messages from these endpoints are fed into the incomingOrderQueue Message
Channel
3. The
messages are consumed from the incomingOrderQueue and routed by a Content- Based
Router to one of two Message Translators.
As the
EIP name implies, the routing destination depends on the content of the message.
In this case we need to route based on whether the content is a CSV or
XML file.
4.
Both Message Translators convert the message content into a POJO, which is fed
into the orderQueue Message Channel.
The
whole section that uses a Content-Based Router and several Message Translators
is referred to as a Normalizer.
This
composite pattern has a unique graphic to depict it but was left out here in
favor of its sub-patterns to make things clearer.
Enterprise Integration Patterns
Architecture
of ServiceMix:
Service
mix is basically divided into two main layer
1. Technology layer---jmx, camel,spring,jbi
2. Core layer---logging,
2. Core layer---logging,
A) The CoreLayer :
A lightweight runtime named “Karaf”, which extendsOSGi with powerful features
for handling and managing OSGI bundles
• B) The Technology Layer : A layer of component technologies that sits on top of the
core to support your applications
Overview on Log4j.properties File:
What is Maven and how do I install it?
Overview on Log4j.properties File:
Log4j will be usually configured using a properties file or xml file externally. So once the log statements are in place you can easily control them using the external configuration file without modifying the source code. Now let's see how you can obtain the same log output as the previous example using the properties file configuration.
Three main components you need to configure to obtain the same result are the logger, appender and layout. The logger object is the one that is used to log messages, appender is the one that specifies the output destination like console or a file and layout is the one that specify the format in which the log messages should be logged.
When you configure using the BasicConfigurator.configure() method by default it uses theConsoleAppender and PatternLayout for all the loggers.
Since the rootLogger level is set to DEBUG all the messages are displayed.
The log4j levels follow the following order.
If you set the rootLogger level to WARN then only the WARN, ERROR and FATAL level log messages will be displayed and the rest will be dropped
MAVEN:Three main components you need to configure to obtain the same result are the logger, appender and layout. The logger object is the one that is used to log messages, appender is the one that specifies the output destination like console or a file and layout is the one that specify the format in which the log messages should be logged.
When you configure using the BasicConfigurator.configure() method by default it uses theConsoleAppender and PatternLayout for all the loggers.
Since the rootLogger level is set to DEBUG all the messages are displayed.
The log4j levels follow the following order.
- DEBUG
- INFO
- WARN
- ERROR
- FATAL
- EXCEPTION
If you set the rootLogger level to WARN then only the WARN, ERROR and FATAL level log messages will be displayed and the rest will be dropped
What is Maven and how do I install it?
Maven is the use of repositories to
manage jarW files across different
projects. In the Maven system, jar files are stored in remote repositories, and
they are downloaded to your local machine to a local repository as needed.
Typically, these same jar files are accessed across projects, and Maven makes
it very simple to manage different versions of jar files, and to group together
sets of related jar files. Building different types of projects (such as jars,
wars, and ears) is handled very cleanly by Maven. Maven can perform tasks such
as generate useful documentation about your project.
To set
up Maven, you need to:
- Download
Maven and unzip it
- Create
a JAVA_HOME System Variable
- Create
an M2_HOME System Variable
- Add
%JAVA_HOME%\bin;%M2_HOME%\bin; to your System Path
To begin with, download the latest
Maven from http://maven.apache.org/download.html. I downloaded apache-maven-3.1.1-bin.zip and extracted it to
C:\dev\apache-maven-3.1.1
More Details about Maven will be Discussed in Next Upcomming Blog.........
Thanks!!!
Subscribe to:
Posts (Atom)