*
The moose likes Tomcat and the fly likes Internet requests to Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Internet requests to Tomcat" Watch "Internet requests to Tomcat" New topic
Author

Internet requests to Tomcat

David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
In a nutshell, I want to set up Apache/Tomcat on Linux Red Hat 9 and be able to access the Tomcat content through the internet (www.mysite.com/myapp/hello).

Does anyone know of another forum or a resource that might have some information on how to do this? I've posted this question here for a couple of weeks and haven't had any luck finding someone that has tried to do this.

BTW - I've tried using both John Turner's and Mike Milison's reference material, with no success.

Thanks in advance for any feedback. David.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I'll bring up something from your previous post:

-------------------------------------------------------------
6) At this point, are you willing to try Tomcat stand-alone? From my own experience, it seems easier to get Tomcat working, and then add apache in front, after the fact.

>> I tried that. I installed Linux, then installed, configured and tested Tomcat. I got it working on http://localhost:8080/myApp/hello but was unable to get the internet access to work (www.mysite.com/myApp/hello).
-------------------------------------------------------------

Which is *before* Apache. So why was it that you couldn't get internet access to work?

Can you get http://www.mysite.com:8080/myApp/hello to work? (using *just* Tomcat ?)

If so, can you configure Tomcat to respond on port 80, restart Tomcat, and then try

http://www.mysite.com/myApp/hello

on linux, to get tomcat to bind on port 80, you'll need to run as root (one step at a time, there's a way to use tomcat non-root on port 80).
David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
Okay, I tried your suggestion and I'm still not having any success...I formatted the machine and installed Red Hat 9 with no web services. After installing Java and Tomcat I then compiled and was able to load a servlet by typing: http://localhost:8080/myapp/hello

I then edited my server.xml file to use port 80 instead of 8080:

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 80 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="80" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->

I restarted Tomcat and typed http://localhost/myapp/hello and the page cannot be found. I then reset my server.xml to use port 8080 and restarted Tomcat and it worked. I tried a second time to set the port to 80 and restarted Tomcat and it still didn't work. Any suggestions? David.
David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
I seem to be getting somewhere now...I started the Tomcat service as ROOT user to get it to bind on port 80 and now I can access the page locally by typing http://darktower/myapp/hello. However, when I try to access the content remotely through the internet (http://mysite.com/myapp/hello) I only get a blank page.

My setup is as follows:

- I have a domain registered (mysite.com) and the IP configured to point to my Red Hat server.
- I have a router that directs all HTTP traffic to the server (192.168.1.xxx)
- When I installed Red Hat, I set the host name to darktower.
- When I installed Red Hat, I did not install any web server services.
- I have only installed Tomcat and Java on this server.
- My /etc/hosts file has only the following entry:

127.0.0.1 darktower localhost.localdomain localhost


Any ideas as to what's missing here to allow access to the Tomcat content through the web (www.mysite.com/myapp/hello)

Thanks again. David
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I've never used RedHat personally, but I keep hearing about the firewall blocking port 80. Is this an issue if you have not installed "web services" ?

can you telnet to your box (from somewhere remote) and connect to port 80 ?
can you ping it ?

your router forwards http traffic to an internal IP, but is your machine using it?

I'm not sure you /etc/hosts is 100% healthy. Mine looks like:

127.0.0.1 localhost
a.real.ip.address thunderbird.mydomain.com thunderbird
[ July 12, 2004: Message edited by: Mike Curwen ]
David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
Regarding the router and port 80: My web address is configured to point to my router (which has a static IP address); the router in turn forwards all HTTP requests to the IP address of the Red Hat server. Previously, I've had this server set up with Apache and been able to access content remotely from the internet (www.mysite.com). So, I can't see there being an issue with the firewall blocking requests on port 80. As it stands now, this is the behaviour I'm getting:

When I don't have the Tomcat service running and I type http://darktower/myapp/hello on the server, a message box pops up that says 'The connection was refused when attempting to contact darktower.'

When start the Tomcat service and I type http://myapp/hello on the server, I get the web page the servlet generates.

When I type http://mysite.com/myapp/hello on the server, I get a blank web page.

I tried adding the following line to my /etc/hosts file:

192.168.1.xxx darktower.mysite.com darktower

(where 192.168.1.xxx is the static IP address I've assigned the server)

This didn't change the behaviour.

It seems to me that since the Apache content can be served remotely through the internet (www.mysite.com) that Tomcat service running on port 80 should work as well. Any further ideas? Many thanks again for your feedback. David.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internet requests to Tomcat
 
Similar Threads
displays "unauthorised" in browser
Help!! - java.lang.OutOfMemoryError
Running IE offline with Tomcat
JServ & Log4J
Very basic questions