Tomcat woes
June 23, 2004 3:51 PM Subscribe
I have Apache 2.0 running. I can easily set stuff up like mod_perl and PHP. I want to start developing w/ Java and I want to run servlets and Tomcat scares me. Does it run under Apache? Seperate from Apache? Any info appreciated.
It's been a couple of years since I used Tomcat, so hopefully this info is not out of date.
Tomcat runs separate from Apache httpd. It will happily run as a standalone web server, which is the easiest way to set it up.
You can also configure httpd to use Tomcat using mod_jk (the name of the module may have changed), which essentially passes requests to Tomcat and sends the response back to the client (it's a bit more complicated than that, but you get the idea).
posted by Emanuel at 5:06 PM on June 23, 2004
Tomcat runs separate from Apache httpd. It will happily run as a standalone web server, which is the easiest way to set it up.
You can also configure httpd to use Tomcat using mod_jk (the name of the module may have changed), which essentially passes requests to Tomcat and sends the response back to the client (it's a bit more complicated than that, but you get the idea).
posted by Emanuel at 5:06 PM on June 23, 2004
just a note, but if you are using gentoo it is incredibly easy to setup. took me all of about 10 minutes.
posted by chrisroberts at 5:28 PM on June 23, 2004
posted by chrisroberts at 5:28 PM on June 23, 2004
Tomcat runs separate from Apache httpd. It will happily run as a standalone web server, which is the easiest way to set it up.
I did some design and coding for a site recently which I believe had this setup (Apache on 80, Tomcat on 8080), and we ran into what became a really big inconvenience. When you have resources that use port numbers, you can't simply write relative URLs anymore. This especially becomes a headache if you have a demo, dev, and live server to sync across....
posted by weston at 6:07 PM on June 23, 2004
I did some design and coding for a site recently which I believe had this setup (Apache on 80, Tomcat on 8080), and we ran into what became a really big inconvenience. When you have resources that use port numbers, you can't simply write relative URLs anymore. This especially becomes a headache if you have a demo, dev, and live server to sync across....
posted by weston at 6:07 PM on June 23, 2004
Tomcat is its own server, but usually we have Apache sitting in front of everything. Apache passes dynamic requests to Tomcat, and handles static files itself. This also means we can run all the nice Apache modules in front, like mod_evasive and mod_cache to improve Tomcat's performance. The conf file for Apache looks like this,
# To redirect to Tomcat/Cocoon for dynamic content.
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^/apache-rproxy-status.* - [L]
RewriteRule !(\.gif|\.jpg|\.jpeg|\.jpe|\.js|\.css) http://TOMCAT:8080%{REQUEST_URI} [P] #rewrite all dynamic pages to Cocoon, leave the rest for Apache.
posted by holloway at 8:02 PM on June 23, 2004
# To redirect to Tomcat/Cocoon for dynamic content.
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^/apache-rproxy-status.* - [L]
RewriteRule !(\.gif|\.jpg|\.jpeg|\.jpe|\.js|\.css) http://TOMCAT:8080%{REQUEST_URI} [P] #rewrite all dynamic pages to Cocoon, leave the rest for Apache.
posted by holloway at 8:02 PM on June 23, 2004
This thread is closed to new comments.
Extract the archive into some directory and run startup.sh or startup.bat. I think there's a .exe for windows users that has some advantage over running startup.bat. Anyways, from there you have two ways to test your servlets. These instructions assume you're using war files.
Option one is to go to localhost:8080/admin and do your stuff from there. You may have to set up an admin user, though, and it requires editing a file or two. A quick google search got me to this page which looks like it will walk you through those steps. Deploying .war files are really easy with their management tools.
I usually don't use that, though, and just drop my war files in the webapps directory and it automatically deploys them.
I've never used the apache JServ module. It'll let you run servlets without having tomcat running using the apache httpd. I think it shares a good bit of code with tomcat.
posted by mragreeable at 5:05 PM on June 23, 2004