Ola pessoal tudo bem? Hoje decidi começar a estudar java para web. Sempre estudei apenas java desktop, e hoje comecei a estudar JSP/Servlets. Estou a apostila da Caelum para aprender os conceitos básicos, e me deparei com o seguinte problema:
Instalei o Tomcat seguindo as instruções da apostila, fiz a integração com o eclipse e o servidor esta funcionando direitinho.
Crei uma primeira servlet num pacote chamado: br.com.teste.servlets.OiMundo
abri o arquivo web.xml gerado pelo eclipse para fazer o mapeamento da servlet.
escrevi no web.xml exatamente isso:
<servlet>
<servlet-name>primeiraServlet</servlet-name>
<servlet-class>br.com.teste.servlets.OiMundo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>primeiraServlet</servlet-name>
<url-pattern>/oi</url-pattern>
</servlet-mapping>
o Eclipse acusa o seguinte problema na tag servlet :
“the markup in the document following the root element must be well-formed”
pq isso acontece. no console aparece as seguintes mensagens:
05/07/2012 17:53:50 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: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\QuickTime Alternative\QTSystem;C:\Program Files\Windows Live\Shared;C:\Users\Anderson\Desktop\VIDA ARTIFICIAL\Swarm-2.2-java\bin;C:\Users\Anderson\Desktop\eclipse;;.
05/07/2012 17:53:51 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
05/07/2012 17:53:51 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
05/07/2012 17:53:51 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 975 ms
05/07/2012 17:53:51 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
05/07/2012 17:53:51 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.28
05/07/2012 17:53:51 org.apache.catalina.valves.AccessLogValve open
GRAVE: Failed to open access log file [C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-05.txt]
java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-05.txt (Acesso negado)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.open(AccessLogValve.java:1115)
at org.apache.catalina.valves.AccessLogValve.startInternal(AccessLogValve.java:1222)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:185)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1156)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1595)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1585)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
05/07/2012 17:53:51 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs
05/07/2012 17:53:51 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager
05/07/2012 17:53:51 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
05/07/2012 17:53:51 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
05/07/2012 17:53:51 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
05/07/2012 17:53:51 org.apache.catalina.startup.Catalina start
INFO: Server startup in 688 ms
notei que ocorreram algumas exceçoes como FileNotFoundException porem não faço a menor ideia do motivo visto que praticamente dei um crtl c / ctrl v na apostila.
Alguem sabe como resolver esses problemas? To completamente perdido ainda nesse mundo java Web haha
Obrigado!