Monthly Archives: September 2008

A Thought about Java EE Applications

Most of the software houses in my country seem to have embraced the concept of EJB3 hardly, for new projects. They develop new projects (and ports) using EJB3 as the middle tier technology, for various reasons.  Majority of the companies also employ Spring Framework as a part of their solutions as well. With the additions of JEE support (XML Bean Definitions) in Spring, the two technologies complements each other, and can be used to promote good programming practices like coding to interfaces, through Spring’s Inversion of Control support. Also, companies are embracing JPA, due to the simple nature of the technology, through “convention over configuration”. Finally, because of the use of EJBs, the solution is deployed into a full blown application server such as JBoss, Websphere, WebLogic etc. 

However, most of these applications are just web applications. And the architecture of these solutions are not distributed. All components of the solution live in a single VM. This raises the question, why do we need EJB? Well, in my perspective, I think it’s basically due to the fact that most developers think EJB is a core part of J2EE stack, and it should be there no matter what. If the final solution is deployed into a clustered environment, if the app is going to be executed in a distributed manner on several VMs, then yes, EJB is the way to go; but why for a webapp which runs in a single VM? Majority of the projects out there are not multi-modular distributed applications. They are single module web applications. IMO, using a technology like EJB is overkill for this type of projects. 

Continue reading

Colombo International Book Fair 2008

I usually visit the Colombo International Book Fair (the ‘BMICH Book Fair’ as most people call it) every year starting from couple of years back, hoping to buy some good books for the reference of the succeeding year. I visited the book fair for today and I have to say that I am quite disappointed with this years one. Out of the three books which I was looking for, I managed only to get one. I couldn’t find the two other books (except for a single silverfish-eaten copy which they offered to me at the discount rate of 33%, even after the discount which was not in a satiable price). I have a feeling like this time, the amount of books in the fair was not as much as the previous ones (at least when considering my field : IT).

I bought a copy of Head First Servlets and JSP 2nd Edition, for the reference of SCWCD exam, which I hope to take sometime in the close future. Apart from this book, I was looking for Rod Johnson’s J2EE Design and Development and J2EE Development without EJB (two very popular titles), which I was not able to find within the fair. This time, there was a small entrance fee (unlike previous ones), but it was said that the amount collected would be used for the improvement of education of children (A Scholarship Trust Fund), so I have no argument against it. Overall, in my humble opinion, the exhibition was ‘alright’, but I wouldn’t call it a massive success, compared with previous ones.

A look at Apache Maven 2

I was using Apache Ant for for managing my day to day build tasks. I wanted to take a look at Maven for sometime now, specially as it is gaining popularity among open source circles, including Apache Software Foundation. But until recently I couldn’t find some free time to spend on Maven. I took a look at what it is here and then, but it was not very clear to me first because the concept of Maven is entirely different from Ant.

This weekend, I managed to spend sometime looking at Maven, and I have to say that I am impressed with the concept. Specially with the concept of using archetypes and phases, building on common patterns in building software. I tried out building simple projects using Maven, but still have to try to create a full blown J2EE application with Maven.

However, one thing I noted was the time it takes to download libraries from remote repositories. Its really annoying, specially when you start working with Maven for the first time, as it downloads required dependency from repositories. Since my Internet connection is not very fast, I had to wait about an hour till all the dependencies (I was trying out AppFuse) was downloaded. Also, later on, I tried to build another project, and it took about 30mins before it was done, because of downloading dependencies. It was really annoying to wait for 30mins just to get your build done. I didn’t like it, and I believe this is same with other developers, as I saw this discussed in developer forums.

Apart from this annoying time it takes for downloading libraries, the concept of Maven is cool, using build patterns, the way it resolves dependencies etc. It’s really worth to spend sometime on this tool, as it can reduce the time you spend working on writing build files (the Ant approach).

Eclipse 3.4 SR 1 – RC 2 New Update Manager / Eclipse 3.5 Galileo

I was using Eclipse 3.4 Milestone 5 until now for development, along with MyEclipse. Most of recent work (including my degree research project) was done in MyEclipse, and I forgot to upgrade to Eclipse 3.4 GA release. Recently, I started working on Eclipse 3.4, and today I saw that this was a milestone release, not the GA release. So I thought of upgrading to GA release, and found out that SR1 RC2 is available.

So I downloaded the JEE bundle of 3.4 SR1 – RC2 and started to update it with the plugins that I generally use. When I was thinking of the hassle of downloading all plugins whenever I upgrade Eclipse, I found this article which teaches how to eliminate exactly that. So I thought of giving it a try with this new version of Eclipse. To my surprise, I found that the update manager feature of SR1 is totally different. I couldn’t figure out where I can change the plugin locations in this new update manager. So I had to fallback to the same old way of updating each installation separately. Also, I found out that does not allow to enter your own names to remote sites. Instead, it automatically reads the name from the update site. On one hand, this is a cool feature that you don’t have to type in everything, but sometimes, you want to have your own names. I think it would be nice if we are allowed to change the name given to the update site entry in update manager.

Apart from the 3.4 SR1 release, I thought of digging a little to find out  what’s happening with next major release of Eclipse, 3.5.  To my surprise, I found that it is named as “Galileo”. I was expecting to see “Io” as the name of next release!. I don’t know why people thought of naming it Galileo, even before all four names of Galileon Moons were used for project names. Anyway, it is good to pay tribute to the person who discovered the moons (thus giving us some cool names to name Eclipse versions). Currently, the GA release is scheduled for June 2009, and Milestone 2 is available. Hope to give a try on Galileo soon.


While I was working on a Struts 2 Project, I wanted to add captcha support to some of my forms. For those who are not familiar with the name, captcha is that small image with letters in forms asking you to type whatever in there (CAPTHCA = Completely Automated Public Test to tell Computers and Humans Apart). So, my first stop was to check the Struts 2 Plugin Repository to find out whether there’s a plugin which can do that. But I had no luck there, and I thought of Googling for some library which could help me with this. I found JCaptcha, an interesting library with lots of features and customizability.

Looking through the product, I found several guides which shows integration of JCaptcha with classic JSP/Servlets, Struts etc, but nothing for Struts 2. When I closely followed the JSP/Servlet example, it was obvious that writing a Struts 2 application to do the same is “no big deal”, but there are some things to be done. So I thought how cool if there was a plugin to do this.

Finally, since I had this idea of trying to develop a plugin for Struts 2 for sometime, I thought of giving it a try, and JCaptcha4Struts2 was born. JCaptcha4Struts2 allows smooth integration of JCaptcha and Struts2, and provides a JSP tag library which developers can use to put a JCaptcha image validation component to their forms with through a single JSP Tag. It supports transparent captcha validation through a base action class or alternatively, through intercepters. If the interceptors are used, it requires slight configuration in the struts.xml file.

The plugin binaries, source, javadoc and a sample web app is available for download in the project site  at Currently the project supports only image captcha generation (where as JCaptcha supports various engines, and captcha types such as sound captcha). Also no i18n support is available yet. I am still working on those areas of the plugin in my free time.