cannot start HTTP Adopter within tomcat
Brought to you by:
simonebordet,
tibu
Hi,
I am trying to start the HTTP adaptor within tomcat 5.0.28.
I am registring it within the init method of a servlet.
However I am always getting a ClassNotFound Exception.
I tried putting the mx4* jars in all possible lib
directories of tomcat with no success. Could anyone help.
Thanks
- Ron.
Logged In: YES
user_id=358158
Tomcat 5.0 is a little tricky, because the Tomcat developers
themselves have instrumented Tomcat with JMX. Very Cool.
However, this means that they have supplied a version of JMX
(I'm not sure which) with Tomcat.
What may be happening is that there is a ClassLoader
problem, where some classes are being loaded from the main
Tomcat ClassLoader, and others from the WebApp ClassLoader.
I looked at this a while ago, so its a little foggy, but
here's how I remember getting it to work.
All the changes I made to get it to work were in the
TOMCAT_HOME/bin
directory.
If you go there, you will see a jmx.jar. What I did as move
this out of the way by renaming jmx.jar to jmx.jar-orig.
Then I copied mx4j-jmx.jar and mx4j-impl.jar into this
directory.
Now, unfortunately, in the bootstrap.jar file, there is a
reference to
jmx.jar Class-Path property of the MANIFEST.MF file. This
needs to
be changed so that the Class-Path includes the MX4J jars
instead.
This can be accomplished by unjar'ing boostrap.jar, modifying
MANIFEST.MF then jar'ing it back up again. My Class-Path line
looked like this when it was alll done:
Class-Path: mx4j-jmx.jar mx4j-tools.jar commons-daemon.jar
commons-logging-api.jar
Last, take the MX4J jars out of your Webapp. Since Tomcat has
already loaded them in the base ClassLoader.
Again, this is a little fuzzy since it's been a while, but
hopefully this is
a helpful start.
Now that I think about it, it may be easy enough to just
copy mx4j.jar
(which includes mx4j-jmx.jar and mx4j-impl.jar) over the
jmx.jar that
comes with the dist, and no other mods are probably necessary.
However, If you need things like the tools in
mx4j-tools.jar, I presume
this will need to be loaded with the rest of them.