This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | New Hint: duplicate Servlet name | ||
---|---|---|---|
Product: | javaee | Reporter: | ecerichter |
Component: | Servlet | Assignee: | issues@javaee <issues> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | dkonecny, marfous |
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
ecerichter
2012-12-10 01:27:26 UTC
That looks like really useful tip for the hint. Thanks for reporting such enhancement. (In reply to comment #0) > what happens, is "error 404: page not found" in > browser, even if ULR is correct. What server do you use? I tried this on GlassFish 3.x and it runs (randomly?) one of the servlets and logs error in its output log about the other servlet class. Your server should not respond with "404" - that's an error on the server side. It should either run one of the servlets or report this problem during application deployment. The IDE hint warning user about this issue makes sense. (In reply to comment #2) > (In reply to comment #0) > > what happens, is "error 404: page not found" in > > browser, even if ULR is correct. > > What server do you use? I tried this on GlassFish 3.x and it runs (randomly?) > one of the servlets and logs error in its output log about the other servlet > class. Your server should not respond with "404" - that's an error on the > server side. It should either run one of the servlets or report this problem > during application deployment. > > The IDE hint warning user about this issue makes sense. I'm using Apache Tomcat 7.0.32. I think either run random servlet or gives 404 error are servers bug. You are completely right, both servers should give an error during deployment. I'll file a bug report against Apache Tomcat. Ok, now I understand Tomcat behavior (that is much better than random choice): a) First servlet is loaded with the name X and url Y b) Second servlet is loaded with the name X and url Z, that replaces the first servlet. What happens is that I can always use url Z, but never url Y. Which servlet gets loaded first and which second is unspecified and can change in different server releases and so it is still "random". I've analyzed this further: 1) If working with web.xml, then the order is the order defined in XML file. 2) If working with annotations, order is unpredictable unless specified a loading order. In that case, the last loaded has precedence. I've created a ticket at Tomcat for this issue: https://issues.apache.org/bugzilla/show_bug.cgi?id=54387 Since I would not be able to open a ticket for every application server in the world, would be nice to have the hint in the IDE as agreed. Thanks, Edson This has been fixed in Tomcat 7.0.35. They asked to Servlet specs team to clarify the correct behavior: container should forbid deployment if two or more servlets have same URL. Bug tracking in Tomcat: https://issues.apache.org/bugzilla/show_bug.cgi?id=54387 Bug tracking from experts: http://java.net/jira/browse/SERVLET_SPEC-53 I think someone should warn Glassfish developers about it. Regards, Edson (In reply to comment #7) > I think someone should warn Glassfish developers about it. Thanks for providing all links. I entered issue against GlassFish and provided there links to issues you entered: http://java.net/jira/browse/GLASSFISH-19547 (In reply to comment #8) > http://java.net/jira/browse/GLASSFISH-19547 According to the GF issue, the warning is already in place since GF 3.1.2. (In reply to comment #9) > (In reply to comment #8) > > http://java.net/jira/browse/GLASSFISH-19547 > > According to the GF issue, the warning is already in place since GF 3.1.2. Good - but the EG explains that the container should not deploy the app in such case. It is an error that prevents the correct execution of the application. Nevertheless, it is Glassfish team decision if they will follow or not the EG guidelines. I'm jusr warning. Regards, Edson Richter (In reply to comment #10) > Good - but the EG explains that the container should not deploy the app in such > case. It is an error that prevents the correct execution of the application. Sorry, I didn't expressed correctly before. The GF not just warns but it doesn't deploy the app and fails with following error: SEVERE: Exception while deploying the app [WebApplication280] SEVERE: Exception during lifecycle processing java.lang.IllegalArgumentException: Servlet [NewServlet] and Servlet [NewServlet2] have the same url pattern: [/NewServlet] This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss |