File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes tomcat 3.2 and invoking a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "tomcat 3.2 and invoking a servlet " Watch "tomcat 3.2 and invoking a servlet " New topic
Author

tomcat 3.2 and invoking a servlet

clyde jones
Ranch Hand

Joined: Dec 02, 2000
Posts: 46
Hi,
I'm invoking servlets using tomcat 3.2(it took forever for me to configure it and figure out where to put the servlets). However, the only way I can invoke them is by http://127.0.0.1:8080/servlet/servletName. I would like to use http://localhost/servlet/servletName. When I use this address, the servlet does not load. I get a message like "server not excepting requests". Does anyone have an idea what I need to do to be able to load the servlets by using localhost? I tried to edit the server.xml, but that didn't work(maybe I didn't edit the right thing). This is not a big deal. I'm just curious.
Thanks In Advance,
Clyde
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Your problem is not with the name "localhost", but with the port number. Your servlet server is configured to use port 8080 (as shown in your first URL), but if you use a name or IP address without a posrt specification, then it assumes port 80.
You have two solutions. The first (to validate that this is indeed the problem) is to access your servlet using http://localhost:8080/servlet/servletName ). The second (more permanent) is to edit the Tomcat configuration file to change the port number from 8080 to 80 and restart Tomcat. Then you should be able to access your servlets without specifying a port number.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
clyde jones
Ranch Hand

Joined: Dec 02, 2000
Posts: 46
Frank,
Thanks for your reply. I figured my problem was with my port setting. However, I did not know where to change the setting. I went to my Tomcat.conf file and did not find 8080, but I found "ApJServDefaultPort 8007". I changed my address to http://localhost:8080/servlet/servletName and got the same error message. I also tried localhost:8007 that returned the same message. Any ideas??? Will I run into a problem not to being able to use http://localhost/servlet/servletName?
Thanks In Advance,
Calvin
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
In your server.xml file, there is a section like the following:

<Connector className="org.apache.tomcat.service.SimpleTcpConnector">
<Parameter name="handler" value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
<Parameter name="port" value="8080"/>
</Connector>
[/qoute]
Change the value to whatever u want.
clyde jones
Ranch Hand

Joined: Dec 02, 2000
Posts: 46
Arian,
Thanks for your reply. I am using tomcat v.3.2.1 and this is the closest thing I've found to what you are talking about:
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
<Parameter name="port"
value="8080"/>
</Connector>
I could not find "simpleTcpConnector". I think I've changed the value of this Parameter to 80 once before and still could not use localhost/servlet/servletName. Any ideas?
Clyde
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Really? That's odd, becuase I have tomcat 3.2.1 and it has it. Did you restart the tomcat after you changed the port number?
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
I have also installed Tomcat 3.2.1 but conf/server.xml <connector> tag does not have the SimpleTcpConnector classname that Adrian is referring to! It only has
<Connector className="org.apache.tomcat.service.PoolTcpConnector">....
Any suggestions?

Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Have you tried to change that port number?
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Yes, I tried to change the port # but it does not serve the pages any more! (I also shutdown and started the tomcat server again).
Is it a possible to change this port # to 80? I think I read in Frank's email somewhere that the reason port #8080 is used is probably to avoid conflict with the HTTP port #80.
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Are you running any other server that might use port 80? Maybe Apache, etc?
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
I have a PWS (for NT)
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

First Attempt:

I changed the port in my server.xml file to 8090 and
http://localhost:8090/ works perfectly.

Second Attempt:

I changed the port in my server.xml file to 80 and
http://localhost/ works perfectly.
I hope the same should work for tomcat 3.2 also,
unless they have changed it. I am currently running tomcat-3.1 on win98.
ps: I have made the change to 80 when I was connected to
the Internet thru my modem. Still tomcat server was running
fine.
However when I am running tomcat on port 80, my PWS would not
start. After shutdown of tomcat, my PWS ran fine. Now (PWS running) when I
try to startup tomcat, it starts and then thows Exceptions and
dies.
One solution would be to STOP your PWS and then trying tomcat
on port 80.

regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited January 18, 2001).]


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Hi:
The connector classname seems to be different (not .SimpleTcpConnector as seen in Madhav's post) in tomcat 3.2.1. It doesn't seem to work right when the port # is changed.
Viji
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
OK, let's try this one:
-----------------------------------------------------------------
<!-- Normal HTTP -->
<Connector xlassName="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler" value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
<Parameter name="port"
value="8080"/> //change this to 80 and it should work fine
</Connector>
------------------------------------------------
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

Adrian:
are you on NT?
It seems that on NT there seems to be a prob when
using port 80.
Now I tested the stuff on NT with Tomcat 3.2 and it
wouldn't start.
regds.
- satya
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Yes, I use windows nt server 4. Make sure you don't have IIS 4 running or any other services that might use port 80. I don't know tomcat is not working on port 80 for you guys, on my machine, it works fine.
Can you guys give me more info on your set up, error messages, logs? I'll try to fingure it out.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

hmmmmm....I am a little confused on what IIS is
I posted earlier but no one ever game me a link or explained
it to me.....anyways I was just testing out stuff for Viji..
I am not sure what else to look for. I checked out the
logs/tomcat.log file but din't find any entries in it...
regds.
- satya
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
IIS is Micrsoft Internet Information Server, it's a combination of Web server, and FTP server. It comes as part of Windows NT Option Pack. If you installed it, it runs on port 80 of course. If you are still having trouble, please give me more spec on your machine, I'll try to help you out.
If worst comes to worst, I'll configured the tomcat and send it to you.
Viji Bharat
Ranch Hand

Joined: Sep 18, 2000
Posts: 101
Adrian/Satya & others:
Thanks for your valuable input. I have got this working for port 80 on a windows NT machine.
Do the following:
1. Stop PWS. (Remember, you cannot have PWS running and expect tomcat server to serv using port 80!! Only one of them can serve using port 80 at a time).
2. Shutdown tomcat server.
3. Go to server.xml, look for port # 8080 (Connector classname doesn't matter!) and change it to 80.
4. Start tomcat server.
5. Now, you can specify the URL as http://localhost/examples... and it works fine.
Thanks
Viji
[This message has been edited by Viji Bharat (edited January 22, 2001).]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Accessing servlets with Tomcat and using IIS - What Tomcat FAQ has to say about this.
Check it out, seems that there is a way to do this.
regds.
- satya
jayram
Ranch Hand

Joined: Oct 30, 2000
Posts: 94
Well i have SimpleTcpConnector and things worked well for me as described
 
Consider Paul's rocket mass heater.
 
subject: tomcat 3.2 and invoking a servlet