Java Chatter and Random Nagging

Monday, October 30, 2006

The IT crowd

I just saw a great show. It's been around for a while but it was the first time I had a chance to see it. It is called The IT Crowd and although it is full of stereotypes of Nerds, it is really funny British humour (or is it Australian). A must see for people in the industry !! Too bad there are only 6 episodes, more info at Wikipedia.

Friday, October 27, 2006

Two great Firefox plugins

My favorite Firefox plugins :
  • IETab : Uses the rendering engine of Internet Explorer to render the webpage inside Firefox.
  • FireBug : Great inspection tool for CSS and debugging tool for javascript.
PS : Firefox 2 is out !!

Thursday, October 26, 2006

Setting up Eclipse WTP and Tomcat

I am currently working on a billing application for an international express/freight company. It required some configuration effort to set up Eclipse WTP and Apache Tomcat (4.0 in my outdated case !!) to debug and run together.

Let's go over the steps to do this:
  1. Create a workspace and import the projects into your Eclipse WTP.
  2. Create a New Server (File - New - Other..) in your Eclipse WTP.
    • Configure your server by pointing to the home folder of your webserver and selecting the JRE.
    • Eclipse WTP creates the local configuration files under your workspace (in my case, in the folder "Tomcat v4.0 Server @ localhost-config").
  3. Open server.xml in your local configuration folder and add the following line :

    <Context path="/${webapp}" docbase="${projectlocation}/${webfolder}" debug="0" privileged="true"/>

    where:
    ${webapp} is your webapplication entry,
    ${projectlocation} is the location of your project
    ${webfolder} is the folder containing your jsp's and WEB-INF folder.
    This line points the Tomcat server to the correct context path so we do not have to deploy everything in our webapps folder but can compile and test everything from within our working directory.
  4. Start/Debug the server from within Eclipse WTP.

Tomcat Remote Debugging and Eclipse

People not using Eclipse WTP (poor fools) but using Eclipse, can take the following steps to enable Eclipse Debugging and Tomcat :
  1. Add the following line to the catalina.bat/.sh file ():

    set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

    • Xdebug : start the jvm and listen for debugging connections.
    • Xrunjdwp... : the info on how to connect to do remote debugging.
    • server=y : start in server mode (i.e. wait for connections, don't go out looking to connect.
    • transport=dt_socked : use sockets to connect.
    • address=8000 : the port to connect to.
    • suspend=n : don't wait for a debugger to tell you what to do, go ahead and launch.
    • Explanation of the options : http://java.sys-con.com/read/44918.htm
  2. Start your Tomcat Server.
  3. In Eclipse, choose Debug... Remote Java application (standard socket attach) localhost 8000.




Note : A very similar approach can be taken to enable 'real' remot debugging of a distant host (not localhost).

Kickoff!

Here we go ! I have been dwelling with the idea of my own blog for a while. But eventually, this is it. You can expect some Technical Java articles on my blog, along with Thoughts about the software industry, the IT consultancy sector more in particular. Lately, I am also interested in Configuration Management, so you can expect some articles on that topic too. I hope you'll enjoy the read.