Tomcat 5.0 and jmx.jar in Eclipse

I used to use the sysdeo Tomcat plugin in Eclipse for my development, but someone suggested that I take a look at the Eclipse Web Tools project, which is an application server feature for Eclipse. It seems like it is the mechanism through which Eclipse is planning to support application servers in the future, so I thought it would be worth a look.

However, once I got it installed, I ran into a problem that is mentioned a few times on various sites on the web, but with few solutions. When I tried to run the application server, I got the following message:

Due to new licensing guidelines mandated by the Apache Software Foundation Board of Directors, a JMX implementation can no longer be distributed with the Apache Tomcat binaries. As a result, you must download a JMX 1.2 implementation (such as the Sun Reference Implementation) and copy the JAR containing the API and implementation of the JMX specification to: ${catalina.home}/bin/jmx.jar

This article describes the workaround that I discovered to make Tomcat 5.0 work correctly inside Eclipse.

But first, let’s step back to find out how I arrived at my current state.

From the Eclipse Web Tools home page, they have a link on the top-right hand side that takes you to the latest download page. For me, I used Version 1.5.2 of the WTP.

On that page they conveniently provide a link where you could download, in one thumping big file, a single zip that contains Eclipse 3.2.1, WTP 1.5.2 and all the other pre-requisites (beware, it is about 200MB!)

On my Ubuntu machine, I originally installed eclipse using apt-get, which installs into /usr/share/eclipse. To preserve all my existing shortcuts, I just renamed that directory to be /usr/share/eclipse3.1, and unzipped the new eclipse into /usr/share/eclipse. I am not really sure if that is the sanctioned way (probably not), but it worked perfectly for me.

Before you create a new project, you will need to go into the Windows/Preferences menu item, and open the Server settings dialog. In here, add a new Server Runtime for Tomcat 5.0 and point it to your default tomcat directory (/usr/share /tomcat5 for me).

newserverruntime1.png
newserverruntime2.png

From there it was a simple matter of creating a new Dynamic Web Project, where it asks me which “Target Runtime” I wanted to deploy into, and I chose the newly created Tomcat 5.0 runtime.

I then developed a simple web application, and when I attempted to start the Tomcat instance, I got the above error message. Searching on the web didn’t give me too much love, and interestingly, I don’t get this message when I start Tomcat using /etc/init.d/tomcat.

Anyway, the solution I found was to edit the runtime classpath of the application server (from the Run/Run… menu) to include the following entries:

run.png

Once I applied those changes, and restarted my application server, everything was working like a champion.

One Response to “Tomcat 5.0 and jmx.jar in Eclipse”

  1. Vamsi Says:

    Hi,

    I was facing the same problem and followed your advice. But it still didn’t work.
    I am using eclipse with tomcat to run my application. prior to this, I was able to use tomcat seperatly for running sample applications, and it never gave any error.

    I did the following things after I encountered this error:
    1. Added a new tomcat server, pointed it to my tomcat home and jre home.
    2. Added the required jar references.
    3. Clicked Run: and still got the same error.

    Can you please help me?

Leave a Reply