You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/09/18 09:23:04 UTC

DO NOT REPLY [Bug 47866] New: NullPointerException in embedded tomcat

https://issues.apache.org/bugzilla/show_bug.cgi?id=47866

           Summary: NullPointerException in embedded tomcat
           Product: Tomcat 7
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: david_syer@hotmail.com


It seems that the WebappClassLoader was stopped?

{noformat}
Caused by: java.lang.NullPointerException
    at
org.apache.catalina.loader.WebappClassLoader.findResources(WebappClassLoader.java:994)
    at java.lang.ClassLoader.getResources(ClassLoader.java:1016)
{noformat}

All I did was launch a server add a context and then ask it to load a resource
from its classpath.  It's a bit more complicated than that, so I'll try and
narrow it down if needed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 47866] NullPointerException in embedded tomcat

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47866

--- Comment #3 from Dave Syer <da...@hotmail.com> 2009-09-21 04:58:38 PDT ---
The problem is that if there is an exception in a ServletContextListener, then
Tomcat.start() fails to actually start the server and actually actively tries
to stop it, destroying the class loader in the process.  Any background threads
started by the listener before it failed can then fail in weird ways, for
instance throwing the exception reported above.

Two things you could do to make it more friendly if you feel like it: 1) throw
a more informative exception in the WebappClassLoader, 2) throw an exception
when Tomcat.start() encounters this kind of problem, and has already called
stop().  

I see this in the log:

{noformat}
2009-09-21 12:56:19,658 ERROR main [org.apache.catalina.core.StandardContext] -
<Error listenerStart>
2009-09-21 12:56:19,658 ERROR main [org.apache.catalina.core.StandardContext] -
<Context [] startup failed due to previous errors>
{noformat}

But the exception that caused this is not propagated.  This is probably more
important than the original NPE.  DO you want to change the bug summary?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 47866] NullPointerException in embedded tomcat

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47866

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #4 from Mark Thomas <ma...@apache.org> 2009-09-22 11:00:32 BST ---
That is a deliberate design decision. A context failing to start isn't
sufficient for Tomcat to fail to start. This is consistent with trying to
deploy an invalid context whilst Tomcat is running. In that case the context
will fail to deploy but Tomcat will continue.

You can use the getState() method to check the state of a context before you
use it.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 47866] NullPointerException in embedded tomcat

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47866

--- Comment #2 from Mark Thomas <ma...@apache.org> 2009-09-21 12:08:45 BST ---
Sorry for the noise. Should be r817201 and r817207

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 47866] NullPointerException in embedded tomcat

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47866

--- Comment #1 from Mark Thomas <ma...@apache.org> 2009-09-21 12:07:31 BST ---
I can't reproduce this with a simple test case (r817201 & r817204). If you can
provide a patch to that test case that demonstrates the issue that would be
great.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org