Bug 52792

Summary: Incomplete error message when lookup a resource that is not bound in the naming
Product: Tomcat 7 Reporter: Violeta Georgieva <violetagg>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: trivial    
Priority: P2    
Version: 7.0.26   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Patch proposal
Incorrect behaviour
Correct behaviour
sample application

Description Violeta Georgieva 2012-02-28 20:30:12 UTC
Created attachment 28401 [details]
Patch proposal

Hi,

I have a servlet that specifies @Resource on a field level. (see attached sample application)
When a request comes for this servlet, Tomcat tries to inject this resource and to instantiate the servlet. If the resource is not found, 500 ISE is returned as a response code. In the error message returned in the error page, it is not specified the full composite name that Tomcat tries to lookup, but only the first part (the context) (see incorrect.png). Thus the end user cannot understand which is the resource that causes the problem, but only the context that cannot be found.

I would like to propose a patch (attached). A screenshot (correct.png) with corrected error message is also attached.

Thanks in advance.
Regards,
Violeta Georgieva
Comment 1 Violeta Georgieva 2012-02-28 20:32:03 UTC
Created attachment 28402 [details]
Incorrect behaviour
Comment 2 Violeta Georgieva 2012-02-28 20:32:34 UTC
Created attachment 28403 [details]
Correct behaviour
Comment 3 Violeta Georgieva 2012-02-28 20:35:36 UTC
Created attachment 28404 [details]
sample application
Comment 4 Mark Thomas 2012-03-07 21:14:23 UTC
Fixed in trunk and 7.0.x and will be included in 7.0.27 onwards.

There were multiple places where this could occur so i fixed them all. I also modified the error message to show the full JNDI name that can't be found as well as the the part that could not be found.
Comment 5 Violeta Georgieva 2012-03-08 06:34:46 UTC
Great.
Thanks