JPA + JSP - Error trying to enter information into database

Asked

Viewed 111 times

0

I have a problem that I’m not able to solve. I’m trying to enter the information in the bank and I’m not getting it. the browser is returning the following error when registering. Served at: /SISTEMA_ESCOLAR

Follows my code.

Class Servletcadastrousuario

package servlet;

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;

import com.cleiton.cadastro.Usuario;
import com.cleiton.topicos2.SalvarUsuario;

@WebServlet("/salvarusuario")
public class ServletCadastrousuario extends HttpServlet {
    private static final long serialVersionUID = 1L;

     private SalvarUsuario salvarUsuario = new com.cleiton.topicos2.SalvarUsuario();

    public ServletCadastrousuario() {
        super();

    }


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        response.getWriter().append("Served at: ").append(request.getContextPath());
    }


    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String nome = request.getParameter("inputNome");
        String cpf = request.getParameter("inputCPF");
        String email = request.getParameter("inpuEmail");
        String senha = request.getParameter("senha");
        String telresidencial = request.getParameter("inputResidencial");
        String celular = request.getParameter("inputCelular");
        String cep = request.getParameter("inputCEP");
        String numero = request.getParameter("inputNumero");
        String logradouro = request.getParameter("inputLogradouro");
        String bairro = request.getParameter("inputBairro");
        String localidade = request.getParameter("inputLocalidade");
        String estado = request.getParameter("inputEstado");


        Usuario usuario = new Usuario();

        usuario.setUSR_NOME(nome);
        usuario.setUSR_CPF(cpf);
        usuario.setUSR_EMAIL(email);
        usuario.setUSR_SENHA(senha);
        usuario.setUSR_TELEFONE(telresidencial);
        usuario.setUSR_CELULAR(celular);
        usuario.setUSR_CEP(cep);
        usuario.setUSR_NUMERO(numero);
        usuario.setUSR_LOGRADOURO(logradouro);
        usuario.setUSR_BAIRRO(bairro);
        usuario.setUSR_LOCALIDADE(localidade);
        usuario.setUSR_ESTADO(estado);



        salvarUsuario.salvar(usuario);

    }

}

Class Salvarusuario

package com.cleiton.topicos2;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import com.cleiton.cadastro.Usuario;

public class SalvarUsuario {
    public void salvar(Usuario ServletCadastrousuario){

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("teste");
        EntityManager em = emf.createEntityManager();
        Usuario CADASTRO_USUARIO = new Usuario();


        CADASTRO_USUARIO.setUSR_NOME(ServletCadastrousuario.getUSR_NOME());
        CADASTRO_USUARIO.setUSR_CPF(ServletCadastrousuario.getUSR_CPF());
        CADASTRO_USUARIO.setUSR_EMAIL(ServletCadastrousuario.getUSR_EMAIL());
        CADASTRO_USUARIO.setUSR_SENHA(ServletCadastrousuario.getUSR_SENHA());
        CADASTRO_USUARIO.setUSR_TELEFONE(ServletCadastrousuario.getUSR_TELEFONE());
        CADASTRO_USUARIO.setUSR_CELULAR(ServletCadastrousuario.getUSR_CELULAR());
        CADASTRO_USUARIO.setUSR_CEP(ServletCadastrousuario.getUSR_CEP());
        CADASTRO_USUARIO.setUSR_NUMERO(ServletCadastrousuario.getUSR_NUMERO());
        CADASTRO_USUARIO.setUSR_LOGRADOURO(ServletCadastrousuario.getUSR_LOGRADOURO());
        CADASTRO_USUARIO.setUSR_BAIRRO(ServletCadastrousuario.getUSR_BAIRRO());
        CADASTRO_USUARIO.setUSR_LOCALIDADE(ServletCadastrousuario.getUSR_LOCALIDADE());
        CADASTRO_USUARIO.setUSR_ESTADO(ServletCadastrousuario.getUSR_ESTADO());
        em.getTransaction().begin();
        em.persist(CADASTRO_USUARIO);
        em.getTransaction().commit();

        //em.close();
        System.out.println("usuário salvo com sucesso!!");
    }
}

I made the change but it’s making the following mistake.

out 30, 2017 7:12:58 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SISTEMA_ESCOLAR' did not find a matching property.
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version:        Apache Tomcat/7.0.77
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built:          Mar 28 2017 16:01:48 UTC
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number:         7.0.77.0
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name:               Windows 7
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version:            6.1
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture:          amd64
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home:             C:\Program Files\Java\jre1.8.0_131
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version:           1.8.0_131-b11
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor:            Oracle Corporation
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE:         C:\apache-tomcat-7.0.77
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME:         C:\apache-tomcat-7.0.77
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\apache-tomcat-7.0.77
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\apache-tomcat-7.0.77
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\apache-tomcat-7.0.77\wtpwebapps
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\apache-tomcat-7.0.77\endorsed
out 30, 2017 7:12:58 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
out 30, 2017 7:12:58 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_131\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_131/bin/server;C:/Program Files/Java/jre1.8.0_131/bin;C:/Program Files/Java/jre1.8.0_131/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Java\jre1.8.0_131\bin;C:\Program Files\OpenVPN\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\eclipse;;.
out 30, 2017 7:12:58 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8080"]
out 30, 2017 7:12:58 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-bio-8009"]
out 30, 2017 7:12:58 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 989 ms
out 30, 2017 7:12:58 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
out 30, 2017 7:12:58 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.77
out 30, 2017 7:12:59 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:12:59 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAÇÕES: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [219] milliseconds.
out 30, 2017 7:12:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\docs
out 30, 2017 7:12:59 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:12:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\docs has finished in 96 ms
out 30, 2017 7:12:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\examples
out 30, 2017 7:13:00 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:13:00 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: contextInitialized()
out 30, 2017 7:13:00 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: SessionListener: contextInitialized()
out 30, 2017 7:13:00 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@30032c0d')
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\examples has finished in 561 ms
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\host-manager
out 30, 2017 7:13:00 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\host-manager has finished in 98 ms
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\manager
out 30, 2017 7:13:00 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\manager has finished in 86 ms
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\apache-tomcat-7.0.77\webapps\ROOT
out 30, 2017 7:13:00 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:13:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\apache-tomcat-7.0.77\webapps\ROOT has finished in 79 ms
out 30, 2017 7:13:00 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-bio-8080"]
out 30, 2017 7:13:00 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-bio-8009"]
out 30, 2017 7:13:00 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 2113 ms
out 30, 2017 7:14:28 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
    name: teste
    ...]
out 30, 2017 7:14:28 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.11.Final}
out 30, 2017 7:14:28 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
out 30, 2017 7:14:28 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
out 30, 2017 7:14:28 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
out 30, 2017 7:14:28 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [servlet.ServletCadastrousuario] in context with path [/SISTEMA_ESCOLAR] threw exception
org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:271)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:858)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:885)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
    at com.cleiton.topicos2.SalvarUsuario.salvar(SalvarUsuario.java:10)
    at servlet.ServletCadastrousuario.doPost(ServletCadastrousuario.java:65)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [com.mysql.jdbc.Driver]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:348)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.loadDriverIfPossible(DriverManagerConnectionProviderImpl.java:160)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildCreator(DriverManagerConnectionProviderImpl.java:116)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:100)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
    ... 37 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:336)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:345)
    ... 49 more

out 30, 2017 7:16:21 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SISTEMA_ESCOLAR] has started
out 30, 2017 7:16:21 PM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 30, 2017 7:16:22 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SISTEMA_ESCOLAR] is completed
  • I believe this is the correct output of your Servlet for a request of the type get. You need to create a request post (e.g., a form that sends the request to Servlet).

  • I did it but it’s making the following mistake.

  • Are you sure the database connection is ok? You have tested a query to see this?

1 answer

0

By your error log, Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver

Tomcat cannot find mysql drive.

If you’re using Maven to manage dependencies:

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.4</version>
            <scope>compile</scope>
</dependency>

If you’re not using Maven, put the mysql connector inside the folder WEB-INF/lib and make sure it’s added to your project’s build path.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.