views:

1501

answers:

3

I'm trying to deploy new web application in Tomcat 6.0, but whenever I click on start button, I repeatedly getting FAIL - Application at context path /Hello could not be started. Other deployed application running fine, whenever I click on start button. But why not this application?

web-xml:

 <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">

<servlet>
<servlet-name>j_security_check</servlet-name>
<servlet-class>EmailHander</servlet-class>
</servlet>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/fail_login.html</form-error-page>
</form-login-config>
</login-config>
<web-app>

This is what Exception I'm getting in catalina log file:

Jan 23, 2010 6:49:31 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/Hello/WEB-INF/web.xml
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1249)
    at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:612)
    at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:619)

What is the reason of that error in web-xml file?

+1  A: 

Is EmailHandler really the full name of your servlet class, i.e. it's not in a package like com.something.EmailHandler? It has to be fully-qualified in web.xml.

skaffman
+4  A: 

Your web.xml ends with <web-app>, but must end with </web-app>

Which by the way is almost literally what the exception tells you.

Bozho
You're correct.
Dusk
+1  A: 

You need to close the XML with </web-app>, not with <web-app>.

BalusC