Wednesday, July 30, 2008

Java User Group Singapore Meeting Up

This is the photo of the last Java User Group Meeting Up at Singapore. The event was around February 18th, 2008.
The host is Ivan Petrov, which provided us with nice place and facilities, even a very nice food. What a great hospitality he had shown to us.
Ben Alex, Principal Software Engineer (3rd from the right), spoke on the to-be-released-soon version of Spring Security (formerly known as AcegiSecurity).
Ben showed us how much easier it is to use the SpringSecurity framework in your JEE web application.
Posted by Picasa

Thursday, July 17, 2008

Apache Tomcat 6.0 Cannot Undeploy Correctly

This 3 months I have been using Tomcat 6.0 for deployment, and one thing that I don't like is that the application server needs to be restarted most of the time when deploying. I remember that this is not the case with my previous development. I thought it was because the Tomcat 6.0. Later I found out that the problem is with the struts-core-1.3.9.jar library.

Several attempts have been made to use the antiJARLocking and antiResourceLocking features of Tomcat. All ends up in futility.

The struts-core-1.3.9.jar (as well as version 1.3.5, 1.3.8) as setup by maven 2 dependency, depends on the Apache commons-digester-1.8.jar. This version (1.8) of the commons-digester library has this bug specific to Windows environment.

There are some workarounds that is possible:

  • Upgrade to higher version of Struts (in the case of my current work, we are moving to struts2 which known not to have this problem)

  • Override the maven 2 dependency, and inject a new dependency to higher version of commons-digester library


First option is obvious, the next will be a bit tricky.
I will show you how to do it later...

Tuesday, July 15, 2008

Sun Developers Day 2008 at Singapore


Today I attended the Sun Developers' Day. My office is not in the habit of sending people to such events, so I have to be a proactive person, take a one day leave to attend this event.
"Sun Developer Day 2008 brings together visionaries, leading experts and developers to seize the next wave of technical innovation through Open Source".

Trends that were presented are in the topics of JavaFX, MySQL, OpenSolaris.

This is my first time attending Sun Developers' Day. There were Sun Developers' Day events in Jakarta, but I didn't manage to have time to attend one of them. 

Some thing that interest me are: JavaFX, VirtualBox, new OpenSolaris eye candy, MySQL tuning, and Solaris DTrace, JDK 6 update 10, Grails.


Matt Thompson, manager of the Sun Technology Evangelist group,  gave an opening message. 

Among the speakers were:

Chuk-Munn Lee, Senior Developer Consultant and Technology Evangelist for Technology Outreach at Sun Microsystems in Singapore.

Joey Shen (Zhuo-Li, Chinese), Technology Evangelist for Sun Microsystems based in Beijing, China.

Peter Karlsson, Solaris Technology Evangelist for Sun Microsystems. 

Raghavan Srinivas, CTO of Technology Evangelism at Sun Microsystems.


This even also intertwinned with JavaJive competition final between universities from Singapore, Malaysia, and Thailand. Previously local competitions have been held in their respective countries. The final presentation brought was won by team from Thailand.



Thursday, July 10, 2008

Liferay 5.0.1 with Tomcat bundle

Why did I choose the Tomcat bundle?

First, unarguably Tomcat is the most popular application server in the planet.
One of the SpringSource guys told me that based on survey, around 80% of the Spring framework
deployment are in Tomcat. There are lots of application currently in production that uses
Tomcat.

Second, that is what the Liferay 4.4 documentation suggest for the development.
(Sadly enough, currently there is no Liferay 5.0.1 documentation...)

Become a bit different from the manual, I choose PostgreSQL 8.2 as my development database instead of MySQL as suggested by Liferay manual. pgAdminIII 1.6.3 feels handy right here.

What you need to do with PostgreSQL is:

Copy the JDBC driver from PostgreSQL installation to the Tomcat library folder.
In my machine I copied from [C:\Program Files\PostgreSQL\8.2\jdbc\postgresql-8.2-506.jdbc4.jar]
to my [d:\opt\liferay-portal-tomcat-5.5-5.0.1\shared\lib] folder.

I edit the d:\opt\liferay-portal-tomcat-5.5-5.0.1\conf\Catalina\localhost\ROOT.xml
Comment out the tag for MySQL, uncomment and adapt the PostgreSQL section.
For my machine, it was setup like this. You might need to adapt to your own database setting.

<resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/lportal"
username="lportal_client"
password="liferay"
maxActive="20"
/>

Remember that some default configuration of PostgreSQL installation disabled the TCP/IP access
to database. You need to enable that, and also you might need to grant permission to where the
TCP/IP client located (in this case your Tomcat application server).

As suggested by the manual, Liferay will do the magic when you change the database, provided
sufficient rights to access the new database. Of course the magic takes some time to perform.

Access the web browser on the url [http://localhost:8080/]. It will display this screen:

Login using:
user: test@liferay.com
pass: test
Click on the [Sign in] button.

The sample page will show you a form asking you to agree/disagree with the Terms and Conditions.

If you get this far that means that you have succeeded setting up a fresh Liferay installation with the database for development.
Good job!

Wednesday, July 9, 2008

Liferay 5.0.1 Up and Running

Yesterday I attended the Liferay Intalio - Join Event, at Hilton Orchard Hotel Singapore.
The presentation itself was very short, but the cocktail is surprisingly quite long. I met great people here.

I believe Liferay is the fastest growing community on open source portal, and has been picking up very well and gaining reputable recognition.

Intalio is also an open source product in a niche market which has gained reputable recognition it its own niche market.

Today I downloaded the latest Liferay 5.0.1 bundled with Tomcat 5.5 from this link:
http://downloads.sourceforge.net/lportal/liferay-portal-tomcat-5.5-5.0.1.zip

I personally still prefer to use the Tomcat 5.5 rather than Tomcat 6.0, not because I'm a slow adapter of this latest app server, but because I found it quite problematic to deploy on Tomcat 6.0. This happens when I was working with a Struts application at my work. Something strange things happened, and Tomcat 6.0 does not show anything. After hours of finding out, I decided to give a try to deploy on Tomcat 5.5, which gave a thorough error message about deployment. It might be because of something the way Tomcat changes the logger between 5.5 and 6.0 which I haven't had time to explore much.

As expected the downloaded bundle works very well with my laptop environment.
I used JDK 5 to run it.

These are the steps needed to make the Liferay 5.0.1 running on my machine:

  1. Extract the file to a folder (mine is [d:\opt\liferay-portal-tomcat-5.5-5.0.1])

  2. Set environment variable CATALINA_HOME to point to [d:\opt\liferay-portal-tomcat-5.5-5.0.1]

  3. Set your CLASSPATH, JAVA_HOME and PATH environment variables

  4. Run Tomcat 5.5 from the command line using "d:\opt\liferay-tomcat-5.5-5.0.1\bin\startup.bat"

  5. Watch the messages

  6. Test if it works by opening through your browser this url: http://localhost:8080/