Problems with Servlet - Please help

Discussions

General J2EE: Problems with Servlet - Please help

  1. Problems with Servlet - Please help (3 messages)

    Hi I have problem in running my first servlet. I am new to J2EE and started with a simple servlet as per instructions from my tutor. I installed Apache Tomcat 6 . I wrote a ServletTest1.java program like this package Check; import java.io.*; import javax.servlet.*; public class ServletTest1 extends GenericServlet { public void service(ServletRequest req,ServletResponse res) throws ServletException,IOException { PrintWriter out=res.getWriter(); res.setContentType("text
    html"); out.println(""); out.println(""); out.println("

    Welcome to Servlet

    "); out.println("This is my first page"); out.println(""); } } I stored the above program under C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Mydir\WEB-INF\classes\Check\ServletTest.java Compiled and created the .class file Now I started the tomcat server. For the deployment descriptor I opened a notepad file and typed the following and saved this as .xml under C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Mydir\WEB-INF ServletTest1 Check.ServletTest1 ServerTest1 /test1/ServletTest1 Now I open browser and type the following http://srinivas-home:8085/test1/ServletTest1 It fails to open and gives a http-404 error. Please let me know whats wrong with the above steps

    Threaded Messages (3)

  2. Web app deployment issue[ Go to top ]

    Your web application is not deployed properly.. login with tomcat manager and check whether it is deployed properly or not...
  3. path[ Go to top ]

    try http://srinivas-home:8085/Mydir/test1/ServletTest1 BTW, res.setContentType("text/html");
  4. Deploy path incorrect[ Go to top ]

    perhaps, you can put your tomcat installation in a place without space in the path. good luck!