Okay, I did research on this, but alas I need another pair of eyes. From this page: http://test.javaranch.com/wiki/view?InvokerServlet In the file conf/web.xml find a section of text that looks like this: <!-- The mapping for the invoker servlet --> <!-- <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>--> You need to uncomment the servlet-mapping and then restart Tomcat to allow all servlets to work.
Yes, I know that this is a security risk, however since I'm going through a textbook that supplies code for many, many servlets... I don't want to add mapping for each of them since this isn't for production (or even development) but for training purposes. However I find myself in a bind-when I save HelloWorld.java and HelloWorld.class file to root/web-inf/classes and then try to call the servlet by: http://localhost:8080/servlet/HelloWorld I get the infamous: The requested resource (/servlet/HelloWorld) is not available. so, what could be wrong? I should be correct in assuming that by uncommenting the servlet invoker that I should be able to type in: http://localhost ort/servlet/servletName and access the servlet, no? I've been all over the Jakarta site, and to tell you the honest truth, Java Ranch is a lot more user friendly... which is how I ended up here (again). I've even tried to place it in the servlets-examples directory, and modified the appropriate web-xml file with the following mapping: <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> and even this: <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>/servlet/HelloWorld</servlet-class> </servlet> But still, no love. Unfortunately, its too late at this hour to head out to the bookstore and reference one of the Sun Core JSP and Servlet texts, so I thought to ask here. Any ideas? Thanks, Michael
Joined: Dec 26, 2003
well, not sure what to make of this. Went to the bookstore and referenced a couple of texts that note that Tomcat is more difficult to config than the other servers. I tried mapping my servlets with no effect, and changed various server.xml and web.xml settings... also in vain. I had previously downloaded Resin, and unzipped that, made one slight change to the server.xml file and presto! Servlets working fine. Strange.
Tomcat seems simple to configure to me. It follows the published servlet API exactly. It is the use of the invoker servlet that has led people astray many times - primarily because earlier versions had it on by default and the introductory books used it. If you are using the invoker servlet, you don't need to define anything in web.xml but the invoker - just make sure your class files end up in the right place. Bill