Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-4848

Undertow does not call the init() method of servlets that implements SingleThreadModel even when load-on-startup is set

    Details

    • Target Release:
    • Sprint:
      EAP 7.0.1

      Description

      Found that some of the servlets did not have the init() invoked on start up. Found that if the servlet implements javax.servlet.SingleThreadModel, their init() methods are not called.

      Sample snippnet from web.xml

      	<servlet>
      		<servlet-name>testServlet</servlet-name>
      		<servlet-class>TestServlet</servlet-class>
      		<load-on-startup>1</load-on-startup>
      	</servlet>
      

      Sample servlet

      @Slf4j
      public class TestServlet extends HttpServlet implements SingleThreadModel {
      
      	@Override
      	public void init(ServletConfig config) throws ServletException {
      		log.info("init() in TestServlet");
      		super.init(config);
      	}
      
      	@Override
      	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
      		log.info("doGet() in TestServlet");
      	}
      
      	@Override
      	public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
      		log.info("doPost() in TestServlet");
      	}
      }
      

      If the servlet does not implements SingleThreadModel , the init() method is called on start up.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  swd847 Stuart Douglas
                  Reporter:
                  lam_shing Shing Lam
                  Tester:
                  Jan Stourac
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: