Я пользуюсь maven сборщиком, может в это проблема? java.lang.ClassCastException: class servlets.MainServlet cannot be cast to class javax.servlet.Servlet (servlets.MainServlet is in unnamed module of loader org.apache.catalina.loader.WebappClassLoader @6efba95f; javax.servlet.Servlet is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @5a7b309b)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java.base/java.lang.Thread.run(Thread.java:834)