Consigo executar o .jsp, porém quando tento executar pelo projeto não funciona [RESOLVIDO]

9 respostas
airmigjr

Pessoal,
estou seguindo um tutorial, e aparentemente tudo funciona.
Porém, se eu executo o projeto pelo index.jsp, tudo funciona, mas se eu tento executar pelo projeto, run-as, nada feito. Assim, se eu gerar o .war não funcionará depois do upload, correto?
Eu gostaria de chamá-lo pelo browser da seguinte maneira: http://localhost:8080/SimpleJspServletDB/
Mas só funciona assim: http://localhost:8080/SimpleJspServletDB/Index.jsp

Será que eu mapeei algo errado? Estou utilizando Eclipse e Tomcat.

segue meu xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>SimpleJspServletDB</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>UserController</display-name>
    <servlet-name>UserController</servlet-name>
    <servlet-class>com.daniel.controller.UserController</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UserController</servlet-name>
    <url-pattern>/UserController</url-pattern>
  </servlet-mapping>
</web-app>

9 Respostas

drsmachado

Compare isto

http://localhost:8080/SimpleJspServletDB/Index.jsp

Com isto

<welcome-file>index.jsp</welcome-file>

Consegue ver o erro?

ThalitaPinheiro

Cuidado com as letras maiúsculas aê… rs

Não só nisso, mas em várias situações.
As vezes nem dá um erro que faça muito sentido, mas ta la um caractere em maiusculo cagando o funcionamento do codigo… :frowning:

airmigjr

Identifiquei o que você disse!!! Muito obrigado pela ajuda!!!, porém, continua não funcionando…
Veja a tela que aparece!

https://www.dropbox.com/s/52zbb111or36g7h/Screen%20Shot%202013-06-12%20at%207.20.02%20PM.png

ThalitaPinheiro

Coloca o log do apache aqui, pra ver o erro…

airmigjr

Só aparece isso… Tudo em vermelho

Jun 12, 2013 7:32:03 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/user/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:HelloWorld’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:HelloWorld com JSP’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:Hello World com JSP - 2’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:PrimeiraAplicacao’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:HelloWorldComImport’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:Getting URL Parameters’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:ManipulationJSP’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:InclusaoDeArquivos’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:imagem’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:RoseIndia’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:SimpleJspServletDB’ did not find a matching property.
Jun 12, 2013 7:32:04 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 12, 2013 7:32:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 629 ms
Jun 12, 2013 7:32:04 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 12, 2013 7:32:04 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Jun 12, 2013 7:32:04 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 12, 2013 7:32:04 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 12, 2013 7:32:04 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/22 config=null
Jun 12, 2013 7:32:04 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 650 ms

airmigjr

Meu, eu descobri que não é só nesse projeto que ocorre isso.
Qualquer outro que contenha um servlet acontece a mesma coisa…

Era para funcionar com um clique do botão direito sobre a pasta do projeto, e RUN AS -> SERVER ?

Então imagino que talvez possa ser alguma coisa relacionada a JAVA_HOME, coisa do tipo… Porque sei fazer essas configurações do CLASS_PATH no Windows, mas no meu Mac eu nunca fiz… Vc faz alguma idéia sobre isso?

ThalitaPinheiro

hum…

já que é assim…

Bom, não tenho mac mas achei esse link http://www.coconnut.com/blog/2012/03/15/instalar-apache-tomcat-en-mac-osx/

Aproveita e baixa o tomcat 7… rs :wink:

ThalitaPinheiro

Agora que percebi que ta em espanhol… :confused:

Espero que não se importe… =(

airmigjr

Meu, muito obrigado!
O que mais valew foi a dica para instalar o Tomcat 7, pois aquele tutorial em espanhol não me ajudou muito, mas fui atrás e achei um tutorial bem legal e instalei o Tomcat 7, configurei as variáveis de ambiente, e agora está funcionando perfeito!!!
De qualquer forma, obrigado pela força!

1 Abração!!!

Criado 12 de junho de 2013
Ultima resposta 12 de jun. de 2013
Respostas 9
Participantes 3