HTTP Status 500 – Internal Server Erro
Boa tarde, estou começando a aprender Java e to fazendo projeto pra web, só que ta dando esse erro. Alguém pode me ajudar? Estou postando também o codigo. obrigado desde já.
Type Exception Report
Message An exception occurred processing [jsp/acesso/menu.jsp] at line [12]
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: An exception occurred processing [jsp/acesso/menu.jsp] at line [12]
9: String senha = request.getParameter("SENHA");
10: Usuario usuEntrada = new Usuario(login,senha);
11: ControllerUsuario usucont = new ControllerUsuario();
12: Usuario usuSaida = usucont.validarWeb(usuEntrada);
13: session.setAttribute("UsuarioLogado",usuSaida);
14: %>
15:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:610)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:499)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:792)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.RuntimeException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
projetolivraria.util.Conexao.getConnection(Conexao.java:17)
projetolivraria.models.daos.DaoUsuario.<init>(DaoUsuario.java:18)
projetolivraria.controllers.ControllerUsuario.validarWeb(ControllerUsuario.java:50)
org.apache.jsp.jsp.acesso.menu_jsp._jspService(menu_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:792)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:792)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828)
com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448)
com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241)
com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
projetolivraria.util.Conexao.getConnection(Conexao.java:15)
projetolivraria.models.daos.DaoUsuario.<init>(DaoUsuario.java:18)
projetolivraria.controllers.ControllerUsuario.validarWeb(ControllerUsuario.java:50)
org.apache.jsp.jsp.acesso.menu_jsp._jspService(menu_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:792)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:792)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="projetolivraria.models.beans.Usuario"%>
<%@page import="projetolivraria.controllers.ControllerUsuario"%>
<%@page import="java.util.Date" %>
<%
String login = request.getParameter("LOGIN");
String senha = request.getParameter("SENHA");
Usuario usuEntrada = new Usuario(login,senha);
ControllerUsuario usucont = new ControllerUsuario();
Usuario usuSaida = usucont.validarWeb(usuEntrada);
session.setAttribute("UsuarioLogado",usuSaida);
%>
<!DOCTYPE html>
<html>
<%@include file="../../inc/materalizeWeb.inc" %>
<title>SISTEMA </title>
<body>
<% if (usuSaida != null) { %>
<!-- Dropdown1 Trigger -->
<a class='dropdown-button btn' data-beloworigin="true" href='#' data-activates='dropdown1'>Manter Usuário</a>
<a class='dropdown-button btn' data-beloworigin="true" href='#' data-activates='dropdown2'>Manter Pessoa</a>
<a class='dropdown-button btn' data-beloworigin="true" href='#' data-activates='dropdown3'>Manter Acesso</a>
<a class='dropdown-button btn' data-beloworigin="true" href='#' data-activates='dropdown3'>Manter Livros</a>
<% if (usuSaida.getTipo().equals("ADM")) { %>
<!-- Dropdown1 Structure -->
<ul id='dropdown1' class='dropdown-content'>
<li><a href="../usuario/inserirUsuario.jsp"> InseriUsuario </a></li>
<li><a href="../usuario/consultarUsuario.jsp"> ConsultaUsuarioParametro </a></li>
</ul>
<% } else { %>
<ul id='dropdown1' class='dropdown-content'>
<li><a href="../usuario/consultarUsuario.jsp"> ConsultaUsuarioParametro </a></li>
</ul>
<% } %>
<% if (usuSaida.getTipo().equals("ADM")) { %>
<!-- Dropdown2 Structure -->
<ul id='dropdown2' class='dropdown-content'>
<li><a href="../pessoa/inserirPessoa.jsp"> InseriPessoa </a></li>
<li><a href="../pessoa/consultarPessoa.jsp"> ConsultaPessoa </a></li>
</ul>
<% } else { %>
<ul id='dropdown2' class='dropdown-content'>
<li><a href="../pessoa/consultarPessoa.jsp"> ConsultaPessoa </a></li>
</ul>
<% } %>
<% if (usuSaida.getTipo().equals("ADM")) { %>
<!-- Dropdown3 Structure -->
<ul id='dropdown3' class='dropdown-content'>
<li><a href="../usupes/inserirRelacaoUsuarioPessoa.jsp"> InseriUsuarioPessoa </a></li>
<li><a href="../usupes/consultarRelacaoUsuarioPessoa.jsp"> ConsultaUsuarioPessoa </a></li>
</ul>
<% } else { %>
<ul id='dropdown3' class='dropdown-content'>
<li><a href="../usuario/consultarRelacaoUsuarioPessoa.jsp"> ConsultaUsuarioPessoa </a></li>
</ul>
<% } %>
<% if (usuSaida.getTipo().equals("ADM")) { %>
<!-- Dropdown3 Structure -->
<ul id='dropdown4' class='dropdown-content'>
<li><a href="../usudriver/inserirRelacaoUsuarioPessoa.jsp"> InseriUsuarioPessoa </a></li>
<li><a href="../usudriver/consultarRelacaoUsuarioPessoa.jsp"> ConsultaUsuarioPessoa </a></li>
</ul>
<% } else { %>
<ul id='dropdown4' class='dropdown-content'>
<li><a href="../usuario/consultarRelacaoUsuarioPessoa.jsp"> ConsultaUsuarioPessoa </a></li>
</ul>
<% } %>
<% } else { %>
<h1>USUÁRIO INVÁLIDO</h1>
<% } %>
</body>
</html>