Spring example Petclinic on Tomcat 6

If you try to deploy one of the Spring 2 samples included in the Spring framework source distribution – Petclinic on Tomcat 6 (6.0.14), the web application does not get loaded and fails with errror. The cause is the ClassNotFound exception for the class org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader, more precisely:


SEVERE: LifecycleException
java.lang.ClassNotFoundException: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

The message is a bit confusing, because after peeking into spring.jar you’ll find out that class in question is it is contained in the jar. What is happening is “classical” issue of classloaders and the who-loads-what problem.

Fortunately, solution is very easy: what helped was copying the spring-tomcat-weaver.jar from Spring distribution into TOMCAT_HOME/lib directory and restarting the container.

This thread was helpful to find out the cause. It may also be mentioned in the documentation, alas – I did not get to reading it yet :-).

Advertisements

11 Responses to Spring example Petclinic on Tomcat 6

  1. dimuthu says:

    This helped me a lot. Thanks!

  2. kike_velez says:

    Thanks from Barcelona (Spain)

  3. tim says:

    Thank you for this tip! gave me an instant fix!

  4. sammyrulez says:

    Thanks

  5. Viral shah says:

    Thanks a ton. This was really helpful.

  6. Morpheus says:

    Thanks!

  7. sean says:

    You the man. Never before have I been so pleased to see a puppy.

  8. Sunset says:

    Thanks from me too.

  9. corbin says:

    thanks

  10. Stanislav says:

    Thanks from Ukraine

  11. Ambuj says:

    This was a great help.

%d bloggers like this: