*
The moose likes Cattle Drive and the fly likes Servlets Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Servlets Container" Watch "Servlets Container" New topic
Author

Servlets Container

Rory Lynch
Ranch Hand

Joined: Aug 03, 2007
Posts: 95
I am currently on OOP4 and I will be submitting my 3rd attempt as soon as I get home (and bath the kids and put them to bed and have some food).

So hopefully, with a little luck, i will be moving down the trail into Servlets creek.

I have had a look ahead and noticed that we are urged to download and install Orion. Over the last week I have downloaded J2EE and also Tomcat and I have just got familiar with the structure of Tomcat, I am also studying for the SCWCD exam and Head First Servlets and JSP recommends Tomcat.

Any objection to me doing the Servlets section of the cattle Drive using Tomcat as my development environment?


I wish that for just one time, you could stand inside my shoes.<br />You'd know what a drag it is to see you.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
No objection. Although officially the Cattle Drive is not yet using Tomcat, we are planning to switch. I'll send you a PM/email with more details.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1195
Are the differences between Tomcat and Orion extreme?
Dick Summerfield
Ranch Hand

Joined: Oct 04, 2007
Posts: 90
Carol,
I have recently installed Tomcat from a "sneak preview" of Marilyn's instructions. Installation went as smoothly as with Orion and the differences are minimal. I redid the Servlets 1 & 2 assignments under Tomcat just to see if they worked... (this guy must be nuts... ) again, no problems.

Probably the most intrusive difference with Tomcat is that it uses port 8080 instead of port 80 used by Orion. Port 80 is default so can be left out of a URL. With Tomcat you have to type:
http://localhost:8080/... but, OK, once it's in the "recently used list" one click suffices.
Daniel Loranz
Ranch Hand

Joined: Jun 17, 2008
Posts: 41
I'm stuck at compiling the example BeeServlet.java.

Here's what I've got ...

- MacBook Pro running OS X 10.5.4

- Tomcat is installed and running. I see the intro page when I point Safari to http://localhost:8080

- The included servlet examples and JSP examples are working. For example, date is behaving as expected.

- java -version at command line returns ...
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

Now when I compile BeeServlet.java, the compiler complains that ...
package javax.servlet.http does not exist

The compiler error message makes me think I need j2EE - to have the correct packages - but I'm really not sure. After all, Tomcat is described as a servlet container - so why do I need additional packages? (I have search JR discussions and googled as well - and am still not sure.)

Thanks for any help.
- Dan
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1195
The file you are lacking is located on my system in C:\j2sdkee1.3.1\doc\api\javax\servlet\http.
So I guess you do need to download the enterprise stuff. I thought it was part of the instructions for setting up your system for the servlets, otherwise I would never have known to do it, (!) but I went back to look, and didn't see it mentioned anywhere. There is also an instruction to put a copy of tools.jar from your JDK into the orion directory. I don't know if tomcat requires that.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Daniel Loranz:
Now when I compile BeeServlet.java, the compiler complains that ...
package javax.servlet.http does not exist

The compiler error message makes me think I need j2EE - to have the correct packages - but I'm really not sure. After all, Tomcat is described as a servlet container - so why do I need additional packages? (I have search JR discussions and googled as well - and am still not sure.)

Thanks for any help.
- Dan

1) I don't recommend compiling within the servlet container
2) Just because the servlet container uses J2EE doesn't mean that your source has access to those files.
3) I have sent you an email.
Daniel Loranz
Ranch Hand

Joined: Jun 17, 2008
Posts: 41
Great - I've successfully compiled BeeServlet.java and see the results when I point my browser to the right spot. Thanks for the great help everyone.

While googling around for info about Tomcat I also came across JBoss and Sun GlassFish. From what I could tell, these all seemed similar, but not 100% overlapping. Any commentary on how these all relate would be very much appreciated.

Thanks!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
JBoss uses Tomcat under the covers but has added layers to deal with EJBs. Tomcat, Orion, JRun, and other servlet containers have much in common. I don't know anything about GlassFish in particular.
Benjamin Hiner
Greenhorn

Joined: Feb 27, 2009
Posts: 12
GlassFish is Sun's reference implementation of J2EE.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlets Container