Monday, 10 September 2012
Introduction to DataSource
Saturday, 12 May 2012
Garbage collection
- Code Segment
- Data Segment
- Stack
- Heap
Friday, 30 March 2012
Application Packaging Structure
A J2EE application consists of one or more J2EE modules and one J2EE application deployment descriptor. An application deployment descriptor contains a list of the applications's modules and information on how to customize the application. A J2EE application consists of one or more Java Archive (JAR) files along with zero or more Resource Archive (RAR) files packaged into an Enterprise ARchive (EAR) file with an .ear extension.
A J2EE module consists of one or more J2EE components for the same container type and one component deployment descriptor of that type. A component deployment descriptor contains declarative data to customize the components in the module. A J2EE module without an application deployment descriptor can be deployed as a stand-alone J2EE module. Types of J2EE modules are as follows:
- Web Application Archive (WAR): A web application is a collection of servlets, HTML pages, classes, and other resources that can be bundled and deployed to several J2EE application servers. A WAR file can consist of the following items: servlets, JSPs, JSP tag libraries, utility classes, static pages, client-side applets, beans, bean classes, and deployment descriptors (web.xml and optionally sun-web.xml).
- EJB JAR File: The EJB JAR file is the standard format for assembling enterprise beans. This file contains the bean classes (home, remote, local, and implementation), all of the utility classes, and the deployment descriptors (ejb-jar.xml and sun-ejb-jar.xml). If the EJB component is an entity bean with container managed persistence, a .dbschema file and a CMP mapping descriptor, sun-cmp-mapping.xml, must be included as well.
- Application Client Container JAR File: An ACC client is a Sun Java System Application Server specific type of J2EE client. An ACC client supports the standard J2EE Application Client specifications, and in addition, supports direct access to the Sun Java System Application Server. Its deployment descriptors are application-client.xml and sun-application-client.xml.
- Resource RAR File: RAR files apply to J2EE CA connectors. A connector module is like a device driver. It is a portable way of allowing EJB components to access a foreign enterprise system. Each Sun Java System Application Server connector has a J2EE XML file, ra.xml.
Lets take a look at them one by one. --
JAR - Java ARchive
It is a file format based on the ZIP file format and similar to ZIP format this is also used for aggregating many files (many be of different types) into one aggregate file. This aggregate file will have (.jar) extension. Application development using Java uses JAR files for many useful purposes. One of the most common use is to package all the .class files, image files, and other files required by an Applet into a JAR file, so that the download of a single file will have all the components downloaded at the client machine. Otherwise, we would require those many HTTP Connections to individually download each of the components and this will of course be a very tedious and time-consuming effort. Another popular usage is to bundle all the .class files, and other required component files of a typical subsystem into a JAR file and include that JAR file into the CLASSPATH of another Java application which requires the services of that subsystem. The maintenance and deployment becomes very easier in this case.
This archive file format is platform-independent format which has been fully written in Java. This format is capable of handling audio and image files in addition to the .class files. It's an open standard and fully extendable. JAR file consist of a ZIP archive and an optional Manifest file, which contains package and extension related data. The Manifest file will have the name 'MANIFEST.MF'. This manifest file belongs to the optional directtory named 'META-INF'. This directory is used to store package and extension configuration data, security related data, versioning related data, services related data, etc.
EJB container hosts enterprise java beans based on EJB API designed to provide extended business functionality such as declarative transactions, declarative method level security and multi-protocol support - more of RPC style of distributed computing. EJB container required EJB module to be packaged in JAR file having ejb-jar.xml file in META-INF folder.
WAR - Web ARchive
As the name suggests this file format is used to package all the components of a Web Application. It may contain JARs, JSPs, Servlets, HTMLs, GIFs, etc. The purpose of this archive format is same as that of the JAR - to make the deployment, shipping, and in turn the maintenance process easier. This will have an XML file named web.xml as the Deployment Descriptor. This Deployment Descriptor is used by the Web Container to deploy the web application correctly.
EAR - Enterprise ARchive
An enterprise application may be composed of several Web Applications and other independent JARs. This archive file format is used in those cases to bundle all the components of an enterprise application into a single file. Again the purpose is same - making deployment, shipping, and hence the maintenance easier. Since, an enterprise application may have several Web Applications as its components, hence an EAR file may contain WARs and JARs. An EAR also contains an XML-based Deployement Descriptor, which is used by the Application Server to deploy the enterprise application correctly.
Below is the model of a typical EAR.
Image 2
Thursday, 29 March 2012
How to determine the memory consumption by a java process
you can try to grep the java process by:
If you are on Windows : get the process id from Task manger that appears on screen after pressing ctrl+alt+delete, by default it doesn't show the pid, however you can custmize this from the view settings, rest steps would be the same.