aspose file tools*
The moose likes Tomcat and the fly likes Tomcat as a server & a container, how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat as a server & a container, how?" Watch "Tomcat as a server & a container, how?" New topic
Author

Tomcat as a server & a container, how?

firas zur
Greenhorn

Joined: May 24, 2005
Posts: 5
I am using Head First Servlet and JSP - Bryan Basham, Kathy Sierra, Bert Bates.

Although it's a great book, it has 1 problem: It assumes I know how to install and configure Tomcat on Windows XP!!

I don't have any web server installed on my Windows XP Server. So how could I install Tomcat so that I could use the book above?

There are so many Tomcats on the web and am lost. Please help me at least search the web? Which one on the following is a prerequisite for running the examples in the book: (so I could search the web for them)

1) Tomcat stand alone
2) In-process Tomcat
3) Out-process Tomcat
4) Install Tomcat after installing J2EE
5) Install Tomcat after installing J2SE
6) Install both Apache and Tomcat

If you indicate which one is the prerequisite for the book, then I could search the web efficiently. Does Kathy or Bert have a website for help?

So far I tried 1st installing J2EE and them Tomcat but I am new to configuring Tomcat to work with Apache! Anyway, the book above only wants Tomcat as a server and a container so how can I get the right Tomcat on my windows XP Server?

I just to make use of the examples in the HF book (hands-on).

Thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you download the exe version of Tomcat (Http://jakarta.apache.org/tomcat), and run it, the installer will walk you through the entire install process.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Moving to the Apache/Tomcat forum.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
firas zur
Greenhorn

Joined: May 24, 2005
Posts: 5
Originally posted by Ben Souther:
If you download the exe version of Tomcat (Http://jakarta.apache.org/tomcat), and run it, the installer will walk you through the entire install process.


But I keep reading in the instructions that Java should be installed 1st.
So to install Java, I install J2EE. But now there is a conflict: When you install J2EE, Apache Server is automatically installed!! But I want Tomcat to be my server (not Apache). So does this mean I have to uninstall J2EE and install something a smaller J2EE (that doesn't have apache)?

It's just I want to follow exactly what the book above says: Tomcat is enough for the purpose of the examples in the book. This is great because I am new and only want Tomcat. I don't want to keep dealing with Apache stuff.

So I need to install Eterprise Edition java because I am interested in servlet (which is am Enterprise Edition software). So how could I decrease J2EE components (by taking out Apache while keeping Java) so I could make Tomcat the Webserver? This way I could use the examples in the book above.
[ May 24, 2005: Message edited by: firas zur ]
Orem Hun
Greenhorn

Joined: May 24, 2005
Posts: 28
I found the following preconfigured version, very easy to install:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/#Preconfigured-Tomcat

It only installs Tomcat, not the J2EE. Where did you install J2EE from ? You just need jdk for Tomcat, so you can run JSP/Servlet. But you cannot run any EJB's, which seems ok for your practice.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
I recommend against installing J2EE - it just complicates things.
Using the Apache webserver just complicates things.
All you need to get started is the J2SE - I suggest you remove J2EE and any trace of your previous Tomcat install completely and install the latest J2SE, then tomcat stand alone.
Bill
firas zur
Greenhorn

Joined: May 24, 2005
Posts: 5
Yes, J2EE complicates things...But I thought since Servlets is a J2EE technology, then J2EE must be installed.

I was wrong. Now I know that Servlets don�t need J2EE. I always assumed Servlets are J2EE technology by mistake, I just followed the instructions above for the pre-configured Tomcat and it just worked (when I typed localhost, a Tomcat page came up!).

But in that Tomcat page when I click on "status", a small window come up (Tomcat Manager Application) asking me for username and password! But if put "admin" as username and nothing for password, I get "HTTP Status 401 -Description: This request requires HTTP authentication ()." What could be the username and password?

How can I find the user name and password when it is all pre-configured for me web page?

Anyway, I was able to install Tomcat, thanks for the input.


[ May 24, 2005: Message edited by: firas zur ]
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
You should be able to find that information in the tomcat-users.xml file, which is located in the $CATALINA_HOME/conf directory.

But, by default no user is setup for /manager or /status access, this is something you will have setup for yourself.

Here is an example:




This should be done while tomcat is down. When finished restart tomcat and give it a try.
firas zur
Greenhorn

Joined: May 24, 2005
Posts: 5
When I put a simple html page, (Hello.html),into the install_dir/webapps/ROOT directory, I get the following error:
"
HTTP Status 404 - /Hello.html
Description: The requested resource (/Hello.html) is not available.
"
I mean I get the above error when trying to access http://localhost/Hello.html from the browser.

I get the error after Tomcat starts successfully.

How could I avoid the error?
I tried putting Hello.html in different directories under WEBAPPS but still it coudln't be accessed from the browser (after entering http://localhost/Test/Hello.html)
[ May 25, 2005: Message edited by: firas zur ]
Orem Hun
Greenhorn

Joined: May 24, 2005
Posts: 28
Check the logs ($CATALINA_HOME/logs), and the error messages on your Tomcat console. It should give some clues.

If you used preconfigured one, I take you already set the variables that are set by a bat file that comes with this install. It sets the following variables:
set PATH=$JAVA-HOME\bin;%PATH%
set JAVA_HOME= J2SE install dir
set CLASSPATH=.;$CATALINA-HOME\common\lib\servlet-api.jar;$CATALINA-HOME\common\lib\jsp-api.jar;..;..\..;%CLASSPATH%
firas zur
Greenhorn

Joined: May 24, 2005
Posts: 5
I re-installed the newest one (not the pre-configured one) and it now works.

So my suggestion to everyone is:
1) Installed the pre-configured one
2) Remomove it while keeping the configuration files for later comparison with later installation
3) Install the newest Tomcat using windows installer (.exe file)
4) Compare the files you saved in 2 with the newest Tomcat one
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by firas zur:
Yes, J2EE complicates things...But I thought since Servlets is a J2EE technology, then J2EE must be installed.

I was wrong. Now I know that Servlets don�t need J2EE. I always assumed Servlets are J2EE technology by mistake, I just followed the instructions above for the pre-configured Tomcat and it just worked (when I typed localhost, a Tomcat page came up!).


You were not wrong. Servlets are a part of J2EE.
Tomcat ships with the J2EE components that it needs.
That's why you don't need to install it yourself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat as a server & a container, how?