O erro está ocorrendo ao adicionar a tag: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Quando retiro a tag acima a página volta a funcionar, porém não consigo evoluir nas aulas.
segue erro emitido:
HTTP Status 500 – Internal Server Error Type Exception Report
Message java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
jakarta.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator org.apache.jasper.servlet.JspServlet.service(JspServlet.java:336) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:770) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) br.com.alura.gerenciador1.servlet.ListaEmpresasServlet.doGet(ListaEmpresasServlet.java:38) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:663) jakarta.servlet.http.HttpServlet.service(HttpServlet.java:770) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) Root Cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator java.base/java.lang.ClassLoader.defineClass1(Native Method) java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
Código listaEmpresas.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.List, br.com.alura.gerenciador1.servlet.Empresa" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- ${empresa.Nome()}
ListaEmpresaServlet.java
package br.com.alura.gerenciador1.servlet;
import java.io.IOException; import java.io.PrintWriter; import java.util.List;
import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse;
/**
Servlet implementation class ListaEmpresasServlet */ @WebServlet("/listaEmpresas") public class ListaEmpresasServlet extends HttpServlet { private static final long serialVersionUID = 1L;
/**
Default constructor. */ public ListaEmpresasServlet() { // TODO Auto-generated constructor stub }
/**
@see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub Banco banco = new Banco(); List lista = banco.getEmpresas();
request.setAttribute("empresas", lista); RequestDispatcher rd = request.getRequestDispatcher("/listaEmpresas.jsp"); rd.forward(request, response);
}
}
Alguém pode ajudar?