Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 516
  • Last Modified:

deploying WARs

hi - i am starting SCWCD study and am having trouble deploying servlets. Using Tomcat 4.1.18 on w2k pro under jdk1.4.1

ide is forte studio 4 U1 and jdev 9 (same problem when using either)

i created a really trivial servlet and a web.xml then deployed the WAR (as webapp1.war) to the webapps folder.

this is the web.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
  <description>Empty web.xml file for Web Application</description>

this is servlet1
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;

public class Servlet1 extends HttpServlet
     private static final String CONTENT_TYPE = "text/html; charset=windows-1252";

     public void init(ServletConfig config) throws ServletException

     public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
          PrintWriter out = response.getWriter();
          out.println("<p>The servlet has received a GET. This is the reply.</p>");
there is also an HTML file at the same level as the WEB-INF folder (which contains the classes folder and within that the servlet class)

i deployed this to the webapps folder as a built WAR and i can browse to the HTML file with http://localhost:8080/webapp1/testhtml.html but http://localhost:8080/webapp1/servlet/Servlet1 fails with a not found error.
if i drop this servlet class into one of the Tomcat example folders, it works, so i know the servlet class isnt corrupt - can anyone give me any advice ?


  • 2
1 Solution
I guess you need a


below the <servlet>.

Another way to solve that would be to enable the Invoker-Servlet in server.xml in your tomcat /conf directory
simonm99Author Commented:
yes, perhaps - you see the web.xml was generated automatically so I'm learning something here. I'll try it and report, thanks
simonm99Author Commented:
thanks - i cant find a way to make JDev do this automatically so i'll have to add it manually for now.

i will investiage the invoker-servlet point also.

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now