3
respostas

Alguém tem o projeto criado até as Session

Troquei de lugar o projeto e agora esta dando erros em todas as classes que eu criei, mas o interessante é que ta dando erro nas classes do java, tipo HttpSession, HttpServletRequest, HttpServletResponse, @WebServlet como se elas não existissem e clicando F1 nelas, pede pra criar, alguém ja passou por isso?

3 respostas

Bom dia Alexandre,

Já aconteceu comigo sim, o problema provavelmente está em alguma configuração do projeto.

Clique botão direito no projeto, Build Path -> Configure Build Path. Vá na aba Libraries e verifique se tem algum item marcado em vermelho. Se tiver, em geral perdeu a referência de onde está aquela biblioteca na máquina. Clique nela de um Edit e aponte o caminho correto.

Outra coisa que pode verificar é se o projeto, que deve ser um Dynamic Web Project, não perdeu essa configuração. Clicando com o botão direito no projeto, vá em Properties -> Project Facets, o item Dynamic Web Module deve estar marcado, de preferência na versão 3.0.

Já aproveitando confere se não perdeu a configuração do Runtime Server (que muito provavelmente é o Tomcat).

Precisando estamos ai, abraço.

agora deu outro erro, erro no tomcat 7, ja exclui, reinstalei, fiz de tudo

mar 20, 2017 9:24:59 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:Gerenciador2' did not find a matching property.
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version:        Apache Tomcat/7.0.76
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built:          Mar 9 2017 13:49:01 UTC
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number:         7.0.76.0
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name:               Windows 10
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version:            10.0
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture:          x86
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home:             C:\Program Files (x86)\Java\jre1.8.0_91
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version:           1.8.0_91-b15
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor:            Oracle Corporation
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE:         G:\AA Cursos Alura\PROGRAMAÇÃO\JAVA\16 Curso Java e JPA Persista seus objetos com a JPA2 e Hibernate\eclipse 32\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME:         G:\DESENVOLVIMENTO\apache-tomcat-7.0.76
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=G:\AA Cursos Alura\PROGRAMAÇÃO\JAVA\16 Curso Java e JPA Persista seus objetos com a JPA2 e Hibernate\eclipse 32\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=G:\DESENVOLVIMENTO\apache-tomcat-7.0.76
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=G:\AA Cursos Alura\PROGRAMAÇÃO\JAVA\16 Curso Java e JPA Persista seus objetos com a JPA2 e Hibernate\eclipse 32\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=G:\DESENVOLVIMENTO\apache-tomcat-7.0.76\endorsed
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
mar 20, 2017 9:24:59 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 (x86)\Java\jre1.8.0_91\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre1.8.0_91/bin/client;C:/Program Files (x86)/Java/jre1.8.0_91/bin;C:/Program Files (x86)/Java/jre1.8.0_91/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Samsung\AllShare Framework DMS\1.3.23\;C:\Program Files\Samsung\AllShare Framework DMS\1.3.23\64bit\;C:\Program Files\Java\jdk1.7.0_79;C:\Program Files (x86)\Brackets\command;C:\ProgramData\chocolatey\bin;C:\Arquivos de Programas\MySQL\MySQL Server 5.7\bin;C:\Program Files\Git\cmd;C:\Users\Programmer\AppData\Local\Microsoft\WindowsApps;C:\tools\mysql\current\bin;;G:\DESENVOLVIMENTO\eclipse 32\eclipse;;.
mar 20, 2017 9:24:59 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8080"]
mar 20, 2017 9:24:59 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-bio-8009"]
mar 20, 2017 9:24:59 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 1018 ms
mar 20, 2017 9:24:59 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
mar 20, 2017 9:24:59 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.76
mar 20, 2017 9:25:00 PM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Gerenciador2]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1119)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Gerenciador2]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    ... 6 more
Caused by: java.lang.IllegalArgumentException: The servlets named [br.com.alura.web.Login] and [br.com.alura.web.LoginComCookie] are both mapped to the url-pattern [/login] which is not permitted
    at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:293)
    at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2458)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2133)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2094)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1303)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:888)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5522)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    ... 6 more

mar 20, 2017 9:25:00 PM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1119)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1127)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    ... 6 more

mar 20, 2017 9:25:00 PM org.apache.catalina.startup.Catalina start
GRAVE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    ... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    ... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1127)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    ... 11 more

mar 20, 2017 9:25:00 PM org.apache.coyote.AbstractProtocol pause
INFORMAÇÕES: Pausing ProtocolHandler ["http-bio-8080"]
mar 20, 2017 9:25:00 PM org.apache.coyote.AbstractProtocol pause
INFORMAÇÕES: Pausing ProtocolHandler ["ajp-bio-8009"]
mar 20, 2017 9:25:00 PM org.apache.catalina.core.StandardService stopInternal
INFORMAÇÕES: Stopping service Catalina
mar 20, 2017 9:25:00 PM org.apache.coyote.AbstractProtocol destroy
INFORMAÇÕES: Destroying ProtocolHandler ["http-bio-8080"]
mar 20, 2017 9:25:00 PM org.apache.coyote.AbstractProtocol destroy
INFORMAÇÕES: Destroying ProtocolHandler ["ajp-bio-8009"]

Boa noite Alexandre,

Este stack trace de erro está dizendo que existem duas Servlets diferentes mapeadas para a mesma URL. A servlet Login e LoginComCookie ambas tem como mapeamento a url /login.

Isso não é permitido, afinal como o Container vai saber pra qual servlet mandar a requisição quando for chamada essa Url?

Abraço.