Servlets not running

Can you please tell my servlets are not running?
I have J2SE and J2EE installed on my machine.
I have apache tomcat 6.0.18 installed as well.
I think may be i have set the wrong paths.
I want to know all details about the paths to be set for the servlets.
Can anyone help please thanks in advance.
i am ๐Ÿ˜”๐Ÿ˜”๐Ÿ˜”๐Ÿ˜”๐Ÿ˜” make me ๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€๐Ÿ˜€


  • mi_pratik
    Front Page - Coreservlets
    Front Page - Coreservlets
    Check this site

    I did a lot time ago that really helped in the servlets part a lot
  • Ashutosh_shukla
    I will check it thanks but any further help is welcome
  • shalini_goel14
    Hi Ashutosh,
    Please confirm if your following classpaths are set properly or not:

    1. Default location for tomcat installed is "C:\ProgramFiles\Apache Software Foundation\Tomcat 6.0"

    If it is other than this
    set JAVA_HOME environment variable to
    Default directory for java installed is "C:\Program Files\Java\JDK1.6"

    2. Confirm if lib folder of tomcat contains servlet.jar
    "C:\ProgramFiles\Apache Software Foundation\Tomcat 6.0\common\lib" folder contains servlet.jar .This jar file is required for running servlets.

    3. Check if "C:\ProgramFiles\Apache Software Foundation\Tomcat 6.0\common\lib\servlet.jar" is included in your CLASSPATH environment variable.Because classes required for running your servlet class can be find from here.

    4. Make sure the class file of your servlet java class exist in tomcat's webapps directory.

    5. Appropriate entry is made in web.xml

    Hope,this info will help you somewhere ๐Ÿ˜€.

    If still any problem exist,better you show us error-logs or setting you have made in your local machine.
  • Ashutosh_shukla
    I have not written any web.xml file can you please help me out with that one I am giving you my servlet code enclosed here in.
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class abc extends HttpServlet
    	public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    		PrintWriter out=response.getWriter();
    		String title="Simple Servlet Output";


    "); out.println("Hello"); out.close(); } }
    I want to know is there any way to check the servlet code without writing the web.xml file each time.confused:
  • shalini_goel14
    Hi Ashutosh,

    If your above code is not giving any compiler errors,then its ok.But you have to make an entry in web.xml.

    I hope u understand how important this entry is ๐Ÿ˜€. Any doubts please specify clearly.
  • Ashutosh_shukla
    Hello, thanks that you are helping but the error is that it cannot find the servlet classes so may be i have set the wrong paths I have checked all the paths they are set as per your saying can you just check my code if it is correct by running it on your platform if possible.I am sick of this error will keep trying to check all paths again but its tuff to find your own errors.Anyways please tell me if code is correect.
  • shalini_goel14
    Hi Ashutosh,

    Your code is absolutely fine.Right now I cannot run it on my system.Have you put the abc.class file in webapps folder of apache tomcat ? If not Please create some folder for eg. servletTest in webapps and in it create one WEB-INF folder and inside WEB-INF create one classes folder .Put your abc.class file there.Also create one web.xml in WEB-INF folder.Once done start the server, open the browser enter the correct url then you will get a page displaying what you tried to print from file.

    If you can get Complete Reference of Java from someone ,better read its Servlet chapter(I guess some 29th-30th chapter in j2se5 edition) . It will definitely solve your problem ๐Ÿ˜€.

    PS: A suggestion Please never make a class like 'abc' in java .Its first letter should be always capital.You could make
  • Ashutosh_shukla
    Ya i know the naming conventions of Java but the point is not that. I will refer the Complete Reference for help for sure I have a copy of that.Anyways I executed the program on a friends machine I got it sorted out.Thanks for all your help.
  • shalini_goel14
    Welcome ๐Ÿ˜€. Please share your actual problem and its solution here.
  • cse_200509
    well !!!
    one thing that is missing is that u need to add an entry for your servlet in
    /tomcat/webapps/examples/WEB-INF/web.xml .
    an entry like this is required:

  • nileshchakkar
    very good descussion by all of you.
    Thanks a lot

You are reading an archived discussion.

Related Posts

I made a web application using and C# with Sql Server2005 as backend as a training project. I wanted to know if its possible to upload that application for...
hi guys, Look what i've discovered on net while browsing! * Building Code Requirements for Structural Concrete (ACI 318-08) and Commentary * Building Code Requirements for Structural Concrete (ACI...
Hey guys, I was wondering if there was a way to scanf/getchar() a string of characters into a table ? Am i shooting for the stars or is it a...
Article written by CEan - Desijays [in Feb 2007] for CrazyEngineers. Windows Vista Its that time of the year again and a new incarnation of another Microsoft OS is slated...
Source: Miss World 2008 Russia is crowned Miss World The eyes of the world were on one stage when Kseniya Sukhinovia from Russia was crowned Miss World in a glittering,...