• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First Servlets & JSP - Tomcat error

 
Christopher Justman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been troubleshooting this error for over a week with no results. So I am hoping to get some help here. I am assuming it is something simple but I can't find it

I am going through the Head First Servlets & JSP book, in the chapter 3 beer advice application tomcat will not successfully the start the application.

I have attempted re-installing different version of Tomcat using the windows installer and the zip versions.

Tomcat: 5.5.27
OS: Vista Home Premium SP1

Error:
Nov 4, 2008 7:10:28 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/beerv1/WEB-INF/web.xml
org.xml.sax.SAXParseException: Element type "web-app" must be followed by either attribute specifications, ">" or "/>".
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:348)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1048)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1173)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:549)
at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:105)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Nov 4, 2008 7:10:28 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Occurred at line 2 column 15
Nov 4, 2008 7:10:28 AM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Nov 4, 2008 7:10:28 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Nov 4, 2008 7:10:28 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/beerv1] startup failed due to previous errors


web.xml:


[ November 04, 2008: Message edited by: Christopher Justman ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it's certainly unhappy with your web.xml. The schema location looks suspect, but I'd not expect the error you are getting.

If it helps, here's the header I use in my web apps:

P.S. Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Christopher Justman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear,

Thanks for the heads up on the UBB code tags, I have updated my post.

I will give the schema locator a try.

Thanks again
 
Christopher Justman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear,

I tried the schema location you posted but still getting the error. Thanks for the suggestion.


Updated web.xml file:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't see anything wrong.

Grasping at straws: are you sure there aren't any weird characters in the file?
 
Christopher Justman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think so, I have recreated the file many times. Some times from scratch and others time using cut and paste. But I have not looked at the file in hex editor, I will give that a try.

Thanks.
 
Christopher Justman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear,

Thanks for the help. I looked at the web.xml file in a hex editor and didn't find any strange characters.

I did finally get the problem fixed!!! I took an example application that came with Tomcat and renamed the directory structure and the added my servlet tags to the existing web.xml file and moved over my needed files.



Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic