Boa tarde, pessoal.
Estou com uma dificuldade qual não sei a solução.
Estou tentando armazenar dados de cadastro no banco porém ele dispara essa exceção.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: #{clienteDao.adicionarCliente}: org.apache.jasper.el.JspMethodNotFoundException: /Cadastro.jsp(35,16) ‘#{clienteDao.adicionarCliente}’ Method not found: br.com.dao.ClienteDao@f268de.adicionarCliente()
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
javax.faces.FacesException: #{clienteDao.adicionarCliente}: org.apache.jasper.el.JspMethodNotFoundException: /Cadastro.jsp(35,16) ‘#{clienteDao.adicionarCliente}’ Method not found: br.com.dao.ClienteDao@f268de.adicionarCliente()
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:99)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
javax.faces.el.MethodNotFoundException: org.apache.jasper.el.JspMethodNotFoundException: /Cadastro.jsp(35,16) ‘#{clienteDao.adicionarCliente}’ Method not found: br.com.dao.ClienteDao@f268de.adicionarCliente()
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:81)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
org.apache.jasper.el.JspMethodNotFoundException: /Cadastro.jsp(35,16) ‘#{clienteDao.adicionarCliente}’ Method not found: br.com.dao.ClienteDao@f268de.adicionarCliente()
org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:71)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
Aqui segue os códigos
<%@page contentType="text/html" import="java.sql.*"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%--
This file is an entry point for JavaServer Faces application.
--%>
<f:view>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Budget Feast - Cadastro</title></head>
<body>
<h:form id="form1">
<h:inputText id="textField1" style="left: 504px; top: 144px; position: absolute; width: 336px" value="#{cliente.nome}"/>
<h:inputText id="textField2" style="left: 504px; top: 192px; position: absolute; width: 336px" value="#{cliente.cpf}"/>
<h:inputText id="textField3" style="left: 504px; top: 240px; position: absolute; width: 336px" value="#{cliente.email}"/>
<h:inputText id="textField4" style="left: 504px; top: 288px; position: absolute; width: 336px" value="#{cliente.telefone}"/>
<h:commandButton id="button1" style="position: absolute; left: 504px; top: 528px" value="SALVAR" action="#{clienteDao.adicionarCliente}"/>
</h:form>
</body>
</html>
</f:view>
Abaixo minha classe de conexão
package br.com.connection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Conexao {
public static Connection getConexao() throws SQLException
{
Connection conexao = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
conexao = DriverManager.getConnection("jdbc:mysql://localhost/database", "usuario", "senhal");
JOptionPane.showMessageDialog(null, "CONECTADO AO BANCO", "AVISO", JOptionPane.INFORMATION_MESSAGE);
}
catch (ClassNotFoundException ex)
{
System.out.println("1\n" + ex.getMessage());
}
catch (SQLException e)
{
System.out.println("2\n" + e.getMessage());
}
return conexao;
}
}
Agora a minha classe ClienteDao
package br.com.dao;
import br.com.bean.ClienteBean;
import br.com.connection.Conexao;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ClienteDao
{
private Connection conexao;
private PreparedStatement stmt;
private ResultSet rs;
public ClienteDao ()throws SQLException
{
conexao = Conexao.getConexao();
}
public void adicionarCliente (ClienteBean cliente)
{
String sql = "INSERT INTO tb_cliente (CPF, NOME, EMAIL, TELEFONE " +
"VALUES (?, ?, ?, ?)";
try
{
stmt = conexao.prepareStatement(sql);
stmt.setString(1, cliente.getCpf());
stmt.setString(2, cliente.getNome());
stmt.setString(3, cliente.getEmail());
stmt.setString(4, cliente.getTelefone());
stmt.execute();
conexao.close();
stmt.close();
}
catch (SQLException ex)
{
Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Alguém consegue me dar algum auxilio
Desde já, agradecido;