Bug 52792 - Incomplete error message when lookup a resource that is not bound in the naming
Incomplete error message when lookup a resource that is not bound in the naming
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
7.0.26
All All
: P2 trivial (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-02-28 20:30 UTC by Violeta Georgieva
Modified: 2012-03-08 06:34 UTC (History)
0 users



Attachments
Patch proposal (551 bytes, patch)
2012-02-28 20:30 UTC, Violeta Georgieva
Details | Diff
Incorrect behaviour (51.47 KB, image/png)
2012-02-28 20:32 UTC, Violeta Georgieva
Details
Correct behaviour (50.89 KB, image/png)
2012-02-28 20:32 UTC, Violeta Georgieva
Details
sample application (1.99 KB, application/x-zip-compressed)
2012-02-28 20:35 UTC, Violeta Georgieva
Details

Note You need to log in before you can comment on or make changes to this bug.
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