GRAVE: Allocate Exception for Servlet

Asked

Viewed 513 times

-2

I’m afraid of this mistake! I’m using Tomcat 8.5

Code

package br.com.controler;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class FormularioServlet {

    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, IOException {
         req.getRequestDispatcher("WEB-INF/formulario.html");
    }
}

hmtl

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Cadastro de livro</title>
</head>
<body>

<fieldset>
     <legend>Pagamento Cartao</legend>
  <form>
        <p><label>Nome</label>
            <input type="text" />
        <p><label>Numero Cartao</label>
            <input type="text" />
        <p><label>Bandeira</label>
            <select name="Bandeira" id="Bandeiras">
                <option value="Visa">Visa</option>
                <option value="Master Card">Master Card</option>
                <option value="Elo">Elo</option>
            </select>
        <p><label>Validade</label>
            <input type="date" />
        <p><label>Codigo</label>
            <input type="text" />
        <p><label>Valor da Compra</label>
            <input type="text" />
        <p><button>Cadastrar</button>
  </form>
</fieldset>

</body>
</html>

web xml.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>testecielo2</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
<servlet>
    <display-name>teste1</display-name>
    <servlet-name>form</servlet-name>
    <servlet-class>br.com.controler</servlet-class> 
</servlet>
<servlet-mapping>
    <servlet-name>form</servlet-name>
    <url-pattern>/form</url-pattern>
</servlet-mapping>


</web-app>

Answer

Sep 04, 2018 9:13:51 pm org.apache.Tomcat.util.digester.Setpropertiesrule Begin WARNING: [Setpropertiesrule]{Server/Service/Engine/Host/Context} Setting Property 'source' to 'org.eclipse.jst.jee.server:testecielo2' Did not find a matching Property. Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Server version: Apache Tomcat/8.5.32 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Server built: Jun 20 2018 19:50:35 UTC Sep 04, 2018 9:13:51 PM org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Server number: 8.5.32.0 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: OS Name: Windows 10 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: OS Version: Sep 10, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Architecture: amd64 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Java Home: C: Program Files Java jre1.8.0_181 Sep 04, 2018 9:13:51 PM org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: JVM Version: 1.8.0_181-B13 Sep 04, 2018 9:13:51 PM org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: JVM Vendor: Oracle Corporation Sep 04, 2018 9:13:51 PM org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: CATALINA_BASE:
C: Users RC01 eclipse-Workspace testeCielo1.metadata.plugins org.eclipse.wst.server.core tmp0 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: CATALINA_HOME:
C: Users RC01 Downloads apache-Tomcat-8.5.32-windows-x64 apache-Tomcat-8.5.32 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Command line argument: -Dcatalina.base=C: Users RC01 eclipse-Workspace testeCielo1.metadata.plugins org.eclipse.wst.server.core tmp0 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Command line argument: -Dcatalina.home=C: Users RC01 Downloads apache-Tomcat-8.5.32-windows-x64 apache-Tomcat-8.5.32 Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Command line argument: -Dwtp.deploy=C: Users RC01 eclipse-Workspace testeCielo1.metadata.plugins org.eclipse.wst.server.core tmp0 wtpwebapps Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Command line argument: -Djava.endorsed.dirs=C: Users RC01 Downloads apache-Tomcat-8.5.32-windows-x64 apache-Tomcat-8.5.32 endorsed Sep 04, 2018 9:13:51 pm org.apache.Catalina.startup.Versionloggerlistener log INFORMATION: Command line argument: -Dfile.encoding=Cp1252 Sep 04, 2018 9:13:51 pm org.apache.Catalina.core.Aprlifecyclelistener lifecycleEvent INFO: 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_181 bin;C: WINDOWS Sun Java bin;C: WINDOWS system32;C: WINDOWS;C:/Program Files/Java/jre1.8.0_181/bin/server;C:/Program Files/Java/jre1.8.0_181/bin;C:/Program Files/Java/jre1.8.0_181/lib/amd64;C: Program Files (x86) Common Files Oracle Java javapath;C: Python27 ;C: Python27 Scripts;C: Programdata Oracle Java javapath;C: WINDOWS system32;C: WINDOWS System32 Wbem;C: WINDOWS System32 Windowspowershell v1.0 ;C: Python27;C: Python27 Scripts;C: Program Files Git cmd;C: Program Files nodejs ;C: Program Files (x86) Windows Kits 8.1 Windows Performance Toolkit ;C: Program Files Java jdk1.8.0_181 bin;C: Program Files Microsoft VS Code bin;C: Programdata Chocolatey bin;C: xampp php;C: Programdata Composersetup bin;C: Users RC01 Appdata Local Microsoft Windowsapps;C: Users RC01 Appdata Roaming Composer vendor bin;C: Program Files Docker Toolbox;C: Users RC01 Desktop;. ] Sep 04, 2018 9:13:51 PM org.apache.Coyote.Abstractprotocol init INFORMATION: Initializing Protocolhandler ["http-nio-8080"] Sep 04, 2018 9:13:51 PM org.apache.Tomcat.util.net.Nioselectorpool)

image

inserir a descrição da imagem aqui

1 answer

0


The error is in the environment configuration: lib javax.servlet.jar was missing and added to Buid-Path

inserir a descrição da imagem aqui

Browser other questions tagged

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