tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 56387] Improve exceptions thrown by stopped WebappClassLoader (to help identify 'stopped state' as the cause of a NoClassDefFoundError)
Date Mon, 14 Apr 2014 18:14:42 GMT

Konstantin Kolinko <> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---
            Summary|tomcat shutdown throw a     |Improve exceptions thrown
                   |NoClassDefFoundError        |by stopped
                   |                            |WebappClassLoader (to help
                   |                            |identify 'stopped state' as
                   |                            |the cause of a
                   |                            |NoClassDefFoundError)
           Severity|normal                      |enhancement

--- Comment #5 from Konstantin Kolinko <> ---
1. What exactly is your version of Tomcat?

So that I can interpret those line numbers in the exception.

2. I agree that the code could be improved to provide more detail.

a) It cannot throw an IllegalStateException (per the API contract), but it can
nest one into ClassNotFoundException that it throws.

b) In WebappClassLoader.loadClass(String, boolean)

        if (!started) {
            try {
                throw new IllegalStateException();
            } catch (IllegalStateException e) {
      "webappClassLoader.stopped", name), e);

That is some logic that logs the access. It would be better to follow that by
failing fast via throwing an ClassNotFoundException instead of continuing.

c) In WebappClassLoader.findClass(String)

It fails fast, but does not provide any details, nor logs this access.

        // Cannot load anything from local repositories if class loader is
        if (!started) {
            throw new ClassNotFoundException(name);

> Add volatile keyword to org.apache.catalina.loader.WebappClassLoader#started
> can help us to find problem quickly.

That would not hurt, but I do not believe that that would help you. I do not
believe that your thread saw stale value of that flag.

I am REOPENING this issue and changing severity and title. I do not see a bug
here, but the behaviour can be improved.

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message