Web Programming

I cannot figure out where errors messages would be contained.

My servlet compiles.  I put my class in web-inf classes folder.  I modified web.xml.  Nothing displays on the screen.  I'm using tomcat 5.5, eclipse 3.1.1 and jre/jdk 1.5.0_06.  I know that I do not need an xml file.  I am using http://java.sun.com/dtd/web-app_2_3.dtd because when I paste this into the browser IE does not complain.  I checked the log directory nothing is there nor in the Eclipse console.
latimercm4Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jagadeesh_motamarriCommented:
but some debug statements and try....so that u can know if there is any problem at some part of the code...(when u say everything seems to be correct)
0
WelkinMazeCommented:
Hi,
You can execute the problem code and if you think that a logfile with error messages has to exist after this point you can make a search of the file system for files newer than the time of execution.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
latimercm4Author Commented:
Here's my source code:

package org.eclipse.Ch11_02;

import java.io.*;import javax.servlet.*;
import javax.servlet.http.*;


public class ClassServlet extends HttpServlet{
      
      public void doGet(HttpServletRequest request,
                                     HttpServletResponse response)
                  throws IOException, ServletException{
                  try {
                        response.setContentType("text/html");
                        PrintWriter out = response.getWriter();
                        
                        out.println("<HTML>");
                        out.println("<HEAD>");
                        out.println("<TITLE>");
                        out.println("Sample Servlet");
                        out.println("</TITLE>");
                        out.println("</HEAD>");
                        out.println("<BODY>");
                        out.println("<H1>");
                        out.println("Sample Servlet");
                        out.println("</H1>");
                        out.println("This servlet is functional.");
                        out.println("</BODY>");
                        out.println("</HTML>");
                        
                  }catch (Exception e){
                        log("ClassServlet The following exception occured: " + e);
                        e.printStackTrace();
                  }catch (Error e) {
                        log("ClassServlet The following Error occurred:" +e);
                        e.printStackTrace();
                  }
      }      
}
0
WelkinMazeCommented:
You may put some  System.out.println("AAAAAAAAAAAAAAA");  statements in the catch clauses to see if your program gets there. If it is then such statements "AAAAAAAAAAAAAAA" will be printed in the Tomcat's console.

Your code seems fine to me at a first glance so maybe there is no errors to be logged so no error log files a re produced.

Also you may consider to replace the following two catch clauses

               }catch (Exception e){
                    log("ClassServlet The following exception occured: " + e);
                    e.printStackTrace();
               }catch (Error e) {
                    log("ClassServlet The following Error occurred:" +e);
                    e.printStackTrace();
               }

just with this one:

               }catch (Throwable e) {
                    log("ClassServlet The following Error occurred:" +e);
                    e.printStackTrace();
               }

It will cover the above two ones.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.