0

I have tried the by of adding the servlet tag to the web.xml file and adding the init method to the servlet. Here is my web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
  <display-name>books_manager</display-name>
  <welcome-file-list>
        <welcome-file>login_page.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    <welcome-file>default.htm</welcome-file>
  </welcome-file-list>
   <servlet>
    <servlet-name>dailyUpdateServlet</servlet-name>
    <servlet-class>com.VishnuKurup.books_manager</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  
</web-app>

and here is the servlet that needs to run on start :

package com.VishnuKurup.books_manager;

import java.util.Timer;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

/**
 * Servlet implementation class dailyUpdateServlet
 */

@WebServlet(name = "dailyUpdateServlet", urlPatterns = { "/dailyUpdateServlet" })
public class dailyUpdateServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    
    public void init() throws ServletException {
        Timer time = new Timer();

        time.schedule(new updateScheduler(), 0, 1000);
    }

}

here is the error message the tomcat server shows :

java.lang.ClassNotFoundException: com.VishnuKurup.books_manager

0 Answers0