Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat 7.0, Eclipse Juno, simple form processing servlet

John Bordenet
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Started with a simple issue that Tomcat wouldn't recognize my servlet. I was able to get to the the initial jsp form.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<form action="VisitServlet" method="post">
Steward Visit Record
Steward: <input type="text" name="steward" size="20">

Last Name: <input type="text" name="lastName" size="20">

First Name: <input type="text" name="firstName" size="20">


Wrote a simple servlet that had nothing to do with the form so I could isolate my issues.
package serve;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.annotation.*;

* Servlet implementation class VisitServlet
public class VisitServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n" +
"<HTML>\n" +
"<BODY>\n" +
"<H1>Hello WWW</H1>\n" +

Since this servlet used annotations, the web.xml file was unnecessary, but I included it anyway.
<?xml version="1.0" encoding="UTF-8"?>

Since I was dealing with "requested resource not found" issue, I visited the Tomcat forum here and changed the server location as suggested. This resulted in a cascade of other issues. After I tried to change it back it back to use the workspace metadata, I continued to receive additional server messages such as
Oct 17, 2012 9:30:21 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Program Files (x86)\Apache\Tomcat 7.0\ROOT\visitKUUC does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(
at org.apache.catalina.core.StandardContext.resourcesStart(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase$
at org.apache.catalina.core.ContainerBase$
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$ Source)
at Source)

Oct 17, 2012 9:30:21 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error in resourceStart()

To make matters worse, the Tomcat logs are not being updated. (This may be because I changed the installation of Tomcat to a new location. Eclipse can find this old directory even though it has been deleted.)
I would appreciate any help to make progress.

John Bordenet

John Bordenet
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You ignore the last section where I changed the server location. I was able to revert it back to the default location and thos messages are resolved.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic