aspose file tools*
The moose likes Other Open Source Projects and the fly likes Just about a frustrated as i can be with Tomcat! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Just about a frustrated as i can be with Tomcat!" Watch "Just about a frustrated as i can be with Tomcat!" New topic
Author

Just about a frustrated as i can be with Tomcat!

DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
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
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
A step-by-step help can be found here:
How to make your first JSP page work on Tomcat?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
packages go in the lib directory under the WEB-INF directory for your application.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
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!
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
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
So create one.
refer to this:
http://jakarta.apache.org/tomcat/tomcat-3.2-doc/appdev/index.html
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

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:

for that example, http://localhost/mywebapp/ShowEvents
would run the EventCalendar servlet (assuming your webapp context set in server.xml was "mywebapp").


Customer surveys are for companies who didn't pay proper attention to begin with.
DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
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?
Joe Gilvary
Ranch Hand

Joined: May 11, 2001
Posts: 152
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
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Just about a frustrated as i can be with Tomcat!