| Summary: | Serve modules without publishing generated invalid server.xml for Tomcat 7.0.x | ||
|---|---|---|---|
| Product: | [WebTools] WTP ServerTools | Reporter: | Steve Ash <stevemash> |
| Component: | jst.server | Assignee: | Larry Isaacs <larryisaacs> |
| Status: | RESOLVED DUPLICATE | QA Contact: | Elson Yuen <eyuen7> |
| Severity: | major | ||
| Priority: | P3 | CC: | slaurent |
| Version: | 3.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Steve Ash
As a followup: I reverted the change introduced in bug 333102 and now (as expected) my webapp launches from the workspace correctly. But now my test with the @WebServlet does _not_ work (also as expected). Clearly, I don't understand the plugin enough to better help to get both bug 318449 and bug 333102 to co-exist in WTP 3.3 + Tomcat7 This is a known issue which is a side effect of fixing Bug 333102. The "/WEB-INF/classes" aliasing you cite is required for Servlet annotations to work. Given that Tomcat is written assuming the webapp lives under a single folder, I'm surprised the "Serve modules without publishing" hack works as well as it does. For the record, here is the explanation provided on the WTP newsgroup: To get servlet annotations working, the servlet classes have to be accessible as resources in addition to being accessible via classloading. As a result, when Tomcat "asks" if "WEB-INF/classes" exists as a resource, the answer from the custom classloader used by the "Serve modules without publishing" is "yes". Tomcat then asks for the URL to "/WEB-INF/classes" in your project, appends the name of the resource (such as "log4j.properties") to that URL and tries to use the URL to read the resource. Since resources destined for "WEB-INF/classes" exist in multiple locations in your project, the URL returned above can only work for one of them. Since you are serving the project directly, "file:" URLs are going to be used. There is no way for the "Serve modules without publishing" option to make it possible for Tomcat to append various resources to the end of a URL and have it access resources that live in multiple locations within the project. The only way to fix this is to change Tomcat to not assume it can modify URLs in this fashion. Twisting a quote from Abraham Lincoln: The "Serve modules without publishing" hack can fool some of Tomcat all of the time, and it can fool all of Tomcat some of the time, but it can't fool _all_ of Tomcat _all_ of the time. *** This bug has been marked as a duplicate of bug 333102 *** This should be fixed with tomcat 7.0.22 which has just bee released FYI: Use of Tomcat 7.0.22 is impacted by Eclipse Bug 360012 if you are using Servlet 3.0 Web applications with "Serve modules without publishing". See the bug for details. |