我正在使用Tomcat 9.0.30,JDK 8和Netbeans 11.3。不知何故,我所有的Web应用程序都无法启动,并且我没有进行任何更改。他们都抛出相同的异常
这里我自动生成了一个servlet,仅转发了一个JSP,但它仍然不起作用。
package servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "ExamController", urlPatterns = {"/ExamController"})
public class ExamController extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
request.getRequestDispatcher("examView.jsp").forward(request, response);
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
}
我通过将Netbeans降级到版本11.1修复了它。
我认为Tomcat 9.0.30和版本高于11.2的Netbeans不兼容。