Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Just about a frustrated as i can be with Tomcat!

 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A step-by-step help can be found here:
How to make your first JSP page work on Tomcat?
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
packages go in the lib directory under the WEB-INF directory for your application.
 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Saloon Keeper
Posts: 21139
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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").
 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21139
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!