Build.xml and servlet?

Hello Friends,

Is build.xml really necessary and can someone pliz explain to me what the code is all about.
I have asked where should i place web.xml is in webapps/sample/WEB_INF/ and MyServlet.class is in webapps/sample/WEB_INF/ classes.Where should i place MyServlet .java?
Im asking this because im getting this error message:

HTTP status 404: “The requested resource (/tomcat/webapps/sample/WEB-INF/classes/servlets/MyServlet) is not available”.

NB: is in webapps/sample/WEB-INF/classes/servlets at the moment.


I don’t quite understand the context of your question, but a build.xml file is for use with the Apache Ant tool (kind of like a more useful version of Make). Check out for more info.

Presumably the ant build script compiles your web service (your current problem appears to be that Tomcat [I assume this is what you’re using as the servlet container] expects a compiled class file/jar and you’re giving it an uncompiled .java file). So yeah, try compiling your source files first.