Bug 40133 - Undefined context path results in NullPointerException
Summary: Undefined context path results in NullPointerException
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.17
Hardware: All All
: P4 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2006-07-28 09:16 UTC by Andreas Plesner Jacobsen
Modified: 2006-12-25 06:16 UTC (History)
0 users



Attachments
Better error message for this situation (2.13 KB, patch)
2006-08-11 10:15 UTC, Andreas Plesner Jacobsen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Plesner Jacobsen 2006-07-28 09:16:04 UTC
If Context attribute name is not set, Cataline won't start and crashes with:
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.lang.NullPointerException
        at java.util.Hashtable.put(Unknown Source)
        at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3801)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3985)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
        at org.apache.catalina.core.StandardService.start(StandardService.java:450)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
        ... 6 more

I'm not sure whether this check should be in StandardContext.java
resourcesStart() or whether the check should happen before resourcesStart() is
called.
Comment 1 Andreas Plesner Jacobsen 2006-08-11 10:15:49 UTC
Created attachment 18698 [details]
Better error message for this situation
Comment 2 Andreas Plesner Jacobsen 2006-08-11 10:16:03 UTC
That should have been Context attribute "path".
A patch that provides a better error message is attached.
Comment 3 Yoav Shapira 2006-12-25 06:16:46 UTC
Good suggestion, I've committed your fix to SVN.  Thanks for reporting this.