https://issues.apache.org/bugzilla/show_bug.cgi?id=56387
Konstantin Kolinko <knst.koli...@gmail.com> 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 <knst.koli...@gmail.com> ---
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) {
                log.info(sm.getString("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
stopped
        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: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to