https://issues.apache.org/bugzilla/show_bug.cgi?id=54713

            Bug ID: 54713
           Summary: <load-on-startup>, @WebServlet(loadOnStartup) do not
                    trigger initialization of Servlet on startup.
           Product: Tomcat 8
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: nicho...@nicholaswilliams.net
    Classification: Unclassified

With the below simple deployment descriptor, the init() method on my Servlet
does not execute until the first request comes in for that Servlet:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                              
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
           version="3.0">

    <display-name>Template Application</display-name>

    <servlet>
        <servlet-name>clusterNode1</servlet-name>
        <servlet-class>com.wrox.ClusterNodeServlet</servlet-class>
        <init-param>
            <param-name>nodeId</param-name>
            <param-value>1</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>clusterNode1</servlet-name>
        <url-pattern>/clusterNode1</url-pattern>
    </servlet-mapping>

</web-app>

Likewise, with the below annotation, the Servlet still does not get initialized
until the first request comes in.

@WebServlet(
        name = "clusterNode1",
        urlPatterns = "/clusterNode1",
        loadOnStartup = 1
)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to