Sunday, 25 February 2007

Martin Fowler speech in Melbourne

2 days ago, I have attended a seminar about "Software Design in the 21th Century". The speaker, Martin Fowler, who is currently very famous celebrity in Software Engineering world, made the speech in the seminar. This seminar was held in Melbourne by Enterprise Java which is a Java community in Australia. His attendence attraced lots of people to come, especially in Java field. In his speech, I jot down several points which I was aware. I am going to share what are these points in here.

- The importance on Open Source. He said nowaday lots of proprietary software, like application servers, technology concepts are not as good as many open source projects. One eaxmple, as we can see, EJB3 by SunMicro System, the persistence storage concept is learned from Hibernate, which is a ORM data storage pioneer. And the IDE tools, he said he quite like IntelliJ since it was out. But Eclipse, he said a copy version of IntelliJ, is now almost dominant the market as it becomes free. He kept repeating on how important position will be Open Source in the future.

- Ruby on Rails or JRuby would probably be the next generation of programming language. As he knows, some of the professional who worked on Java for many yaers have already switched to Ruby. But still, as he mentioned, Java and .NET will still dominant the market in the next 5 years.

- As he is the pioneer of Agile methodology, of course in his speech, he talked about how important on Test-Driven programming, it would be a tragedy if a software without a good test.

- The position on AOP. He was making a joke that AOP is best tool for Logging only.

- A Framework should not do too many things. A framework should be as simple as possible, not tightly couple to each others.

I do get a lot of things from his speech. At least I know how are those people focusing on and the technology trend in the next few years, especially on Open Source. What I used in Hong Kong was proprietary application servers, tools. But it looks like the outside world are very focusing on Open Source projects. I do agree with Martin at this point. If more people starts to focus on Open Source, lots and lots of Corporation, Governments who needs a large amount of support may tend to give up these propriertary software and use Open Source tools. But it may be only a dream of mine...

Monday, 12 February 2007

MyEclipse, Maven2, Tomcat5.5 Hot deploy

Thanks to my colleague who find out how to do a hot deploy under using these tools combination - MyEclipse, Maven and Tomcat. It is a problem which last long for a certain period of time.

In his solution, what he does is basically

1. create a Java Build Path Library which point to local maven repository
2. change the project web root directory to maven build structure, which is "/src/main/webapp", in .mymetadata file.
3. use maven-eclipse-plugin in your pom.xml

So next time you run "mvn eclipse:eclipse", you should be able to locate all classes from your local maven repository. And after that, whenever you press "save" in eclipse, it will automatically deploy all the classes to your tomcat webapps folder.

In here, I will give a bit more amendment.

Since the hot deploy will copy all needed jar file from your local repository to Tomcat webapps folder, sometimes you don't want some classes to be deployed to the Tomcat, for example, servlet-api.jar. It is because it is provided by Tomcat already. You don't want any conflict between your application and Tomcat. Please note that deployment in MyEclipse will copy every jar from maven local repository even if you specify "provided" in the dependency scope from your pom.xml.

Luckily, Tomcat is clever enough on not to use your servlet-api.jar. Instead, it will use it's own. However, if you are using servlet 2.4 and jsp 2.0, since you need to provide jsp-api.jar file. Tomcat will not be able to determine not to use it. Therefore, a conflict will happen, the error usually will happen like this if you are using JSTL:

org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld".

In this case, the current solution that I have is to delete the jsp-api.jar file from your application deployed folder manually, which is in /webapps/{your app}/WEB-INF/lib

Then the problem will be solved. However, as you can see, the trouble is whenever you redeploy using the hot deploy solution above. You will need to delete the necessary file manually.

-----------------------------------------------------
-----------------------------------------------------
Further amendment:

As I mentioned above, Tomcat is NOT clever enough to skip the jsp-api.jar deployment. However, for my further investigation, I found that this symptom only happened in Tomcat 5.5.12 and 5.5.17. (I assume it happens in between these version as well). So if you are using the most updated Tomcat version, which I have updated to 5.5.23, it will work perfectly fine.

Happy programming!!!