glassfish
  1. glassfish
  2. GLASSFISH-19547

Having servlets with same url should at least cause warning

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.1.2.2
    • Fix Version/s: None
    • Component/s: web_container
    • Labels:
      None

      Description

      Originally reported by user against NetBeans IDE. I'm also attaching link to issues he entered against Tomcat and the specification which were already probably fixed:
      http://netbeans.org/bugzilla/show_bug.cgi?id=223563
      https://issues.apache.org/bugzilla/show_bug.cgi?id=54387
      http://java.net/jira/browse/SERVLET_SPEC-53

      Shortly, mapping two servlets to the same name should lead at least to warnings during the application deployment or the app shouldn't be deployed at all. See links above for much more information.

      Examples of the problem:

      Example 1: Web.xml
      ...
      <servlet>
      <servlet-name>PrintDacteServlet</servlet-name>
      <servlet-class>br.com.simfreteV1.web.PrintDacteServlet</servlet-class>
      </servlet>
      <servlet>
      <servlet-name>CotacaoReportServlet</servlet-name>
      <servlet-class>br.com.simfreteV1.web.CotacaoReportServlet</servlet-class>
      </servlet>
      <servlet-mapping>
      <servlet-name>PrintDacteServlet</servlet-name>
      <url-pattern>/secure/relatorios/Action</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>CotacaoReportServlet</servlet-name>
      <url-pattern>/secure/relatorios/Action</url-pattern>
      </servlet-mapping>
      ...

      Example 2: annotations in java servlet files

      @WebServlet(name = "PdfReportPrint", urlPatterns =

      {"/secure/relatorios/doReport"})
      public class PdfReportPrint extends AbstractBaseServlet {
      ...

      @WebServlet(name = "PrintBoletoServlet", urlPatterns = {"/secure/relatorios/doReport"}

      )
      public class PrintBoletoServlet extends HttpServlet {
      ...

        Activity

        Hide
        Shing Wai Chan added a comment -

        I have used asadmin deploy a war with two servlets having the same url pattern.
        The deployment fails as follows:

        remote failure: Error occurred during deployment: Exception while deploying the app [a] : Servlet [test1] and Servlet [test2] have the same url pattern: [/test]at org.glassfish.apf.AnnotationInfo@49950c0d. Please see server.log for more details.
        Command deploy failed.

        I have verified the above behavior in 3.1.2, 3.1.2.3 and 4.0 workspace.

        Show
        Shing Wai Chan added a comment - I have used asadmin deploy a war with two servlets having the same url pattern. The deployment fails as follows: remote failure: Error occurred during deployment: Exception while deploying the app [a] : Servlet [test1] and Servlet [test2] have the same url pattern: [/test] at org.glassfish.apf.AnnotationInfo@49950c0d. Please see server.log for more details. Command deploy failed. I have verified the above behavior in 3.1.2, 3.1.2.3 and 4.0 workspace.
        Hide
        Shing Wai Chan added a comment -

        I have verified there is the same error for directory deployment which is used by NetBeans. So, the developers are notified for the issue.

        Show
        Shing Wai Chan added a comment - I have verified there is the same error for directory deployment which is used by NetBeans. So, the developers are notified for the issue.
        Hide
        marfous added a comment -

        Sorry for late response, I overlook notifications. You are right, it warns users in GF versions you mentioned. Thanks a lot for evaluation.

        Show
        marfous added a comment - Sorry for late response, I overlook notifications. You are right, it warns users in GF versions you mentioned. Thanks a lot for evaluation.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            marfous
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: