My experiments with technology

Entries from July 2007

Hibernate: continuing the path of discovery

July 22, 2007 · 4 Comments

This is a continuation of my previous post. This post investigates the various properties available on the class element available in the persistent class hbm.xml file.

(more…)

Categories: Hibernate

Kick starting Hibernate

July 21, 2007 · 2 Comments

I had worked on Hibernate some years back. I decided it was time for me to do a refresher on hibernate and check out its new features and also verify if I remember anything that had learned few years back.

(more…)

Categories: Hibernate

How to memory profile a linux machine?

July 20, 2007 · Leave a Comment

Found an interesting blog about memory profiling a linux box.

Categories: Uncategorized

Fixing: “An unexpected error has been detected by HotSpot Virtual Machine”

July 20, 2007 · 5 Comments

I had been consistently facing the standard “An unexpected error has been detected by HotSpot Virtual Machine”. I spent some time trying to figure out the root cause of the problem. I was not able to make any headway for some days.

Yesterday google search provided me with the answer. Added the following JVM option

-Djava.net.preferIPv4Stack=true

And presto the JVM crashes ceased. The above mentioned thread mentions that the Inet4AddressImpl is not thread-safe. If you thought the Sun guys were GODS, you must be mistaken. They are just mere mortals like us.

Categories: JVM · JVM HotSpot

Great Resources and Links

July 12, 2007 · 1 Comment

Here I intend to provide a common repository to some thought provoking articles and useful resources. This is just the beginning. I intend to update this post at regular intervals.

(more…)

Categories: AJAX · Database · Java · Java EE · Web Site Design

What is a Software Component?

July 12, 2007 · Leave a Comment

Yesterday a team member asked me to explain what a software component is. Even though I was able to provide a reasonable answer, the question fascinated me to do a bit of research on the topic.

Let’s start with the definition. Here’s what Google returned:

A reusable piece of software in binary form that can be easily integrated with other components with relatively little effort.

An alternative definition is:

A software component is a unit of composition with contractually specified interfaces and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties.

One of the primary features of software component is information hiding. The component can be treated as a black box which defines a crisp interface to the outside world. The implementation is carefully hidden from the end user, thus allowing for implementation change at a later point in time. Components are easily usable in different application contexts. As a consequence, components need to be self-contained software entities.

The most common example of a component that comes to my mind is JDBC drivers. They have

  1. Contractually defined interfaces – They implement the JDBC specifications.
  2. Context Independence – The JDBC jars do not depend upon any other component besides the Java runtime for their execution.
  3. High Reuse – They do not need any further code customization i.e. they are ready-to-use.

Another example of a software component would be EJB. The application developer needs to implement the home, remote and ejb bean and is provided with out-of-the-box support for transaction management, security, persistence etc.

Categories: Driver · EJB · JDBC · JDBC Driver · component · software component

Identifying linux server ports in use

July 12, 2007 · Leave a Comment

Some days back I was facing an interesting problem. We have multiple tomcat instances configured on a single Linux box. The box was configured to have more than one internal ips. I needed to know which ports were active. Did some browsing on the net (essentially did a google search ;-) ) and found a Linux command nmap.

Used the following command

nmap -sT -p

For example:

nmap -sT 127.0.0.1 -p 1-9000

This is the command to check ports from 1 to 9000 on the server 127.0.0.1. There is a -sS option available for users with root privileges but myself a lowly developer does not enjoy such rights.

Categories: Tomcat · ip · nmap · port