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
Explore posts in the same categories: Java, springframework

10 Comments on “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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: