开发者

problem with running Servlet on Tomcat: InvocationTargetException

I am new to Tomcat, and trying to run a simple HelloWorld servlet. I have installed Tomcat 6, and Jdk1.6 on Mandriva Linux, set CLASSPATH and JAVA_HOME. I have the following files and directories:

$CATALINA_HOME/webapps/MyApp/WEB_INF/classes/TestServlet.class         
$CATALINA_HOME/webapps/MyApp/WEB_INF/web.xml

My web.xml file contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<!--?xml version="1.0" encoding="ISO-8859-1"?-->

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

    <description>ZibJana Localization</description>
    <display-name>ZibJana Localization</display-name>             
    <!-- Define the servlets for this application-->
    <servlet>
        <servlet-name>ZibJana</servlet-name>
        <servlet-class>TestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ZibJana</servlet-name>
        <url-pattern>*</url-pattern>
    </servlet-mapping>  
</web-app>

But when I try 开发者_开发技巧to invoke my servlet with url http://localhost:8080/MyApp, tomcat fails to launch launch the servlet. I checked in the $CATALINA_HOME/logs/catalina.out log-file and found the following error, which occurs every time I start tomcat service.

INFO: Deploying web application directory MyApp
16-Mar-2010 12:05:38 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Please let me know where my mistake is. Thanks in advance.


I just posted the relevant portion of the stack trace. Anyways, I solved the problem. It was an issue with directory structure and web.xml file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜