OK, I give up......what the heck do you have to do to set up package URLs in Tomcat...Ive edited the web.xml as such but this stupid thing still cant find it! What the heck am I doing wrong here? here's the web.xml set up for the servlet: <servlet> <servlet-name> EventCalendar </servlet-name> <servlet-class> com.inlvr.calendar.event.EventCalendar </servlet-class> </servlet> Any hints would be of GREAT help here.......I normally work in Resin (which makes this stuff a 30 second job) and Im really stuck with this one........thanks in advance
Im running servlets, not JSP's. Also there is no lib folder under the web-inf file for ANY of the apps (examples, root etc...) Im running stuff out of the ROOT folder for testing purposes. Im also stuck with Tomcat 3.2.2....Help!
Joined: May 05, 2000
Originally posted by DC Dalton: Im running servlets, not JSP's. Also there is no lib folder under the web-inf file for ANY of the apps
You don't have a Tomcat problem - you have a general problem in understanding how to put together a web application! Whether you're using Tomcat 3, Tomcat 4, or WebLogic 6, the classes all go in the WEB-INF folder off the root of the web app. Loose classes go in WEB-INF/classes and JARs go in WEB-INF/lib. In the case of loose classes, you MUST replicate the complete package structure under the classes directory - see http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=50&t=000870 for examples. Now for the other big question, and I think it's the one that is actually giving you headaches. In Tomcat, the ability to treat the web server like a file server is deprecated. It was a major security exposure, so now ALL servlets MUST be mapped to a URL. In order to do this, you need *2* clauses - one to map the URL to a symbolic name for the servlet and another to specify what class is attached to that symbolic name. That may sound needlessly complicated, but there are some definite benefits to it. OK - here's an example:
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: May 28, 2001
OK, lets SLOW down here. Ive read alll of this stuff that you've suggested and followed it to the letter (as far as i can tell) My class files are in a package com.inlvr.calendar.event and are in the root/web-inf/classes folder. I have also changed the web.xml, previously mentioned to reflect this as the jakarta instructions say. Like this: <servlet> <servlet-name> EventCalendar </servlet-name> <servlet-class> com.inlvr.calendar.event.EventCalendar </servlet-class> </servlet> I am calling http://localhost:8080/servlet/EventCalendar but nothing is being found.........Am I missing something here or what?
Joined: May 11, 2001
You're still missing the . Check Tim's example above. He also pointed out that you need to set a context in server.xml. I think the Apache documentation for this stuff is pretty well done. There are several examples from server.xml files in their docs at http://jakarta.apache.org/tomcat/tomcat-3.2-doc/uguide/tomcat_ug.html The web.xml format for Tomcat 3.2 is drawn from the Servlet 2.2 spec, not the more recent 2.3 spec. Scroll down part way on http://java.sun.com/products/servlet/download.html to download the older spec. The web.xml deployment descriptor DTD is in Chapter 13. IMHO, the docs for Catalina are more helpful. If there is a chance you can upgrape to Tomcat 4, go for it. HTH, Joe
Sorry, didn't mean to come off as flamish - but you were kicking the poor Tomcat for for supporting a standard meant to make it easier (in the long run!) to write standard, secure, server-independent web apps. One way in which the <servlet-mapping> facility comes in useful is seen in Jakarta Struts, where any URL ending with a selected extension (typically ".do") gets routed to the central Struts dispatcher servlet. The removal of the "implicit" access facility ensures that if you have a chain of servlets forwarding to each other, someone can't just type in a URL for one of the secondary servlets and bypass critical functions supplied by the initial one(s).