[fedora-java] How to debug a Tomcat5 servlet on Fedora

Ryan McDougall ryanm at ashleyassociates.co.jp
Tue Dec 13 03:04:04 UTC 2005


I hope this is one topic for this list, if not a redirect would be
greatly appreciated.

I am trying to set up a simple servlet, which according to various
tutorials, should work. However it doesnt, and I am unable to find out
why. The tomcat manager simply tells me "FAIL - Application at context
path /myservlet could not be started" and thats it.

My question is how can I tease out enough information to discover what
the problem is? I am a decently experienced programmer, so _any_ sekret
kungfu would be helpful. This is a high priority for my company, so
thats all Im working on at the moment, but Im stuck without the tools to
debug+solve my own problem ATM.

Java Source: 
import javax.servlet.http.*;
import java.io.*;

public class TestWebApp extends HttpServlet 
{
    static final long serialVersionUID =0;

    public void doPost (HttpServletRequest req, HttpServletResponse resp) throws IOException 
    {
	resp.setContentType ("text/html");
	PrintWriter out = resp.getWriter ();
	out.println ("w00t");
    }
}

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

<servlet> 
<servlet-name>testapp</servlet-name>
<servlet-class>TestWebApp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>testapp</servlet-name>
<url-pattern>/myservlet/*.do</url-pattern>
</servlet-mapping>

</web-app>

deployed in $CATALINA_HOME/webapps/myservlet
./myservlet/WEB-INF/web.xml
./myservlet/WEB-INF/classes/TestWebApp.class
./myservlet/WEB-INF/lib

When I try to start the servlet the relevant output of 
tail /var/log/tomcat5/localhost_log.2005-12-13.txt:
2005-12-13 11:19:56 StandardContext[/manager]HTMLManager: init: Associated with Deployer 'localhost'
2005-12-13 11:19:56 StandardContext[/manager]HTMLManager: init: Global resources are available
2005-12-13 11:19:56 StandardContext[/manager]HTMLManager: list: Listing contexts for virtual host 'localhost'
2005-12-13 11:20:02 StandardContext[/manager]HTMLManager: start: Starting web application at '/myservlet'
2005-12-13 11:20:02 StandardContext[/manager]HTMLManager: list: Listing contexts for virtual host 'localhost'

Which errors out with:
FAIL - Application at context path /myservlet could not be started

ps. Should be an up-to-date stock fedora core 4:
tomcat5-servlet-2.4-api-javadoc-5.0.30-5jpp_6fc
tomcat5-jasper-5.0.30-5jpp_6fc
tomcat5-jasper-javadoc-5.0.30-5jpp_6fc
tomcat5-5.0.30-5jpp_6fc
tomcat5-webapps-5.0.30-5jpp_6fc
tomcat5-servlet-2.4-api-5.0.30-5jpp_6fc
tomcat5-admin-webapps-5.0.30-5jpp_6fc
java-1.4.2-gcj-compat-debuginfo-1.4.2.0-40jpp_31rh.FC4.2
java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_31rh.FC4.2
java-1.4.2-gcj-compat-1.4.2.0-40jpp_31rh.FC4.2
libgcj-4.0.2-8.fc4
libgcj-devel-4.0.2-8.fc4
libgcj-src-4.0.2-8.fc4
java-1.4.2-gcj-compat-src-1.4.2.0-40jpp_31rh.FC4.2

but I also have the sun sdk installed:
 /usr/sbin/alternatives --display java
java - status is auto.
 link currently points to /usr/lib/jvm/jre-1.4.2-gcj/bin/java
/usr/java/jdk1.5.0_04/bin/java - priority 2
 slave rmiregistry: /usr/java/jdk1.5.0_04/bin/rmiregistry
 slave jre_exports: (null)
 slave jre: /usr/java/jdk1.5.0_04/jre/
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420
 slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
 slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj
 slave jre: /usr/lib/jvm/jre-1.4.2-gcj
Current `best' version is /usr/lib/jvm/jre-1.4.2-gcj/bin/java.

 /usr/sbin/alternatives --display javac
javac - status is auto.
 link currently points to /usr/lib/jvm/java-1.4.2-gcj/bin/javac
/usr/lib/jvm/java-1.4.2-gcj/bin/javac - priority 1420
 slave java_sdk: /usr/lib/jvm/java-1.4.2-gcj
 slave java_sdk_exports: /usr/lib/jvm-exports/java-1.4.2-gcj
 slave javadoc: /usr/lib/jvm/java-1.4.2-gcj/bin/javadoc
 slave javah: /usr/lib/jvm/java-1.4.2-gcj/bin/javah
 slave jar: /usr/lib/jvm/java-1.4.2-gcj/bin/jar
 slave rmic: /usr/lib/jvm/java-1.4.2-gcj/bin/rmic
Current `best' version is /usr/lib/jvm/java-1.4.2-gcj/bin/javac.


Cheers,
Ryan




More information about the fedora-devel-java-list mailing list