0

I was trying to redeploy a servlet I had recently undeployed but kept getting a org.apache.catalina.LifecycleException. Tomcat wasn't able to load the context properly.

This is what triggered the search:

FAIL - Unable to delete [/var/lib/tomcat7/conf/Catalina/localhost/app.xml].
       The continued presence of this file may cause problems.

Here are the errors from the log catalina.out, rearranged to fit the column:

WARNING: Calling stop() on failed component [{0}] to trigger clean-up
         did not complete.
org.apache.catalina.LifecycleException: 
         An invalid Lifecycle transition was attempted ([after_stop]) for 
         component [org.apache.catalina.startup.FailedContext@13150fc] in state
         [FAILED]

WARNING: Error while removing context [/app]
java.lang.ClassCastException:
         org.apache.catalina.startup.FailedContext cannot be cast to 
         org.apache.catalina.core.StandardContext

Scrolling back up, I noticed a whole list of SEVERE errors, beginning with:

SEVERE: Parse error in context.xml for /app
    org.xml.sax.SAXParseException; 
    systemId: file:/etc/tomcat7/Catalina/localhost/app.xml/;
    lineNumber: 1;
    columnNumber: 1;
    Content is not allowed in prolog.

This is not related to Cannot Undeploy a web-app completely in Tomcat 7 or Installing JSTL results in org.xml.sax.SAXParseException: Content is not allowed in prolog, though I wasted quite some time looking through these. Everything seemed to be as it should be, so I was stumped. Eventually, I solved it myself. My answer is below.

Community
  • 1
  • 1
icedwater
  • 4,701
  • 3
  • 35
  • 50

1 Answers1

0

It turns out that I had deployed

/path/to/servlet/web/

as the XML Configuration file instead of

/path/to/servlet/website.xml

as Tomcat had been expecting.

A quick check in the saved form content of my other browser revealed this kickself error, so I am posting a Q and A here in the hope that this could save someone some time.

Please be careful when deploying manually, people.

icedwater
  • 4,701
  • 3
  • 35
  • 50