aspose file tools*
The moose likes Tomcat and the fly likes Request to Tomcat from remote machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Request to Tomcat from remote machine" Watch "Request to Tomcat from remote machine" New topic
Author

Request to Tomcat from remote machine

David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
I posted this question a few days back and haven't received any response. I've searched the postings here and on Google and can't find any information or help. Maybe I'm not wording my question correctly. Could someone take a look at my question and tell me if there's a better way to phrase it so I might find some information? Thanks again. David.

Original post:

I have a Win2K server running Apache2 and Tomcat4, integrated with the mod_jk connector. I have tested both services locally (http://localhost and http://localhost/examples/servlets/index.html) and I am able to see the content for both. There's no problem when I access the Apache content from a remote machine through the server's web address (http://www.mywebsite.com); the pages show up as expected. However, when I try to access the Tomcat content remotely (http://www.mywebsite.com/examples/servlets/index.html) the page cannot be found.

Can somebody tell me how I configure Apache/Tomcat to be able to acheive this functionality?

Many thanks in advance.

David
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I have a few clarifications.

'locally' means from the same machine that apache and tomcat are located on?

when you browse to http://localhost/ you get the "you have successfully set up Apache" page? (or whatever else you've got for your default host?)

you browse to http://localhost/examples/servlets/index.html and get the static page located in $CATALINA_HOME/examples/servlets/index.html


then 'remotely'... you mean from another computer on the same network, or from right outside, and the request comes in from the big 'internet' cloud?

What does your httpd.conf and server.xml files look like? (not the whole things, just the appropriate pieces)

What exact error message do you get? ('not found' means what?). Is there anything in the apache access/error logs ?

p.s. -> you so far haven't hit the jk connector with either of these requests (neither one calls for dynamic java content.)
[ June 08, 2004: Message edited by: Mike Curwen ]
David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
Here goes...

'locally' means from the same machine that apache and tomcat are located on?
>>>Yes. I have Windows 2000 Server, Apache 2 and Tomcat 4 all running on the same machine.

when you browse to http://localhost/ you get the "you have successfully set up Apache" page?
>>>Yes. From the server machine, I type http://localhost and see the default web page that I have set up (which resides in c:\apache\apache2\htdocs).

you browse to http://localhost/examples/servlets/index.html and get the static page located in $CATALINA_HOME/examples/servlets/index.html
>>>Yes. From the server machine, I type http://localhost/examples/servlets/index.html and see the static
HTML Tomcat Welcome page (which resides in c:\tomcat\tomcat-4.1\webapps\examples\servlets).

then 'remotely'... you mean from another computer on the same network, or from right outside, and the request comes in from the big 'internet' cloud?
>>>From another computer on the same network. From this 'other' machine, I type www.mysite.com and get the default web page I have set up. Next, I type www.mysite.com/examples/servlets/index.html and at this point, I cannot see the static HTML Tomcat Welcome page. The browser gives me a message saying the site cannot be found.

What does your httpd.conf and server.xml files look like? (not the whole things, just the appropriate pieces)
>>>I'm not sure what's appropriate, but here's a sample:
(httpd.conf)
### Section 1: Global Environment
.
.
.
#Added 06/04/2004 DAP
LoadModule jk_module modules/mod_jk.dll

### Section 3: Virtual Hosts
.
.
.
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

(server.xml)
#Added 06/04/2004 DAP
Include c:/tomcat/tomcat-4.1/conf/auto/mod_jk.conf

<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true">
#Added 06/04/2004 DAP
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" forwardAll="false"
modJk="c:/apache/Apache2/modules/mod_jk.dll" />

What exact error message do you get? ('not found' means what?). Is there anything in the apache access/error logs ?
>>>This one's a problem at the moment; I'm formatting that server at the moment, so I can't get the logs as they no longer exist.
When I get it set up again, I'll mimic the behaviour to generate the logs.

p.s. -> you so far haven't hit the jk connector with either of these requests (neither one calls for dynamic java content.)
>>>I thought the jk connector was responsible for passing requests from Apache to Tomcat through port 80 (eliminating the need to include the Tomcat port designation in the URL http://localhost:8080/examples/servlets/index.html)!?!?

>>>I really appreciate your getting back to me and for your help. I just graduated and I learned the programming end of this stuff in one of my classes, but it was all done using the http://localhost configuration. We didn't learn how to set up a live (production) environment and when I asked how to do this, my prof told me to look it up on the web, so here I am. 1000 thanks for you help. David.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I have a couple things:

1. The httpd.conf section you quoted is pretty much all commented out (#), so that particular virtual host is non-existent. Besides that, it contains no jkmount directives. Perhaps that's explained by #2,

2. I see you're attempting to use the auto/mod_jk.conf. I'm of a mixed feeling about this. I've never used it myself, but I understand the temptation is strong to do so. I think the 'speed' you gain from it is offset by the inflexibility. Also, if that line is truly in server.xml , then I'm surprised if Tomcat is even starting. This line belongs in httpd.conf.

3. The jk connector is the piece responsible for forwarding requests from Apache to Tomcat, but only those requests that it a) is configured to forward and hopefully b) makes sense to forward. Requesting an HTML page, and having it forwarded to Tomcat for serving, would break the b) requirement, at least.

Have you checked out http://www.raibledesigns.com/tomcat/index.html ?
While this talks about load-balancing two tomcats, the essential configuration for just a single tomcat would remain unchanged. I believe these instructions are still valid for TC 4.1.30

There is also this:
http://galatea.com/flashguides/apache-tomcat-4-win32.xml
Be careful not to mix the instructions for using that auto-generated conf file, with the instructions for "do it yourself" (they are generally incompatible).
[ June 09, 2004: Message edited by: Mike Curwen ]
David Perry
Greenhorn

Joined: Dec 12, 2003
Posts: 19
Thanks for your help. I've not been able to find much information on configuring this Windows, so I'm going to give it a shot with Red Hat 9.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request to Tomcat from remote machine
 
Similar Threads
Tomcat as Public Web Server
Apache Not able to get html files & GIF files placed in the Tomcat
unable to start tomcat
Internet requests to Tomcat
Internet requests to Tomcat