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

How to make Tomcat and Apache cooperate?

Yichuan Wang
Greenhorn

Joined: Jan 17, 2008
Posts: 8
Hi, There is a problem occurred when I tried to make Tomcat and Apache work together.
I have both Tomcat and Apache installed on my desktop, an additional helper
software(Jakarta Tomcat connecter) is also installed which connects Apache with Tomcat.
When there is a static html page, apache handles it, and when there is a JSP page apache passes it over to Tomcat.


When I use port 80(Apache):
It works perfectly when it processes JSP pages, but it just can not process servlets.

This is the configuration I added to Apache httpd.conf








anybody could possibly tell me why?
or should I change line:JkMount /servlet/* ajp13
to something else?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Originally posted by Yichuan Wang:
When there is a static html page, apache handles it, and when there is a JSP page apache passes it over to Tomcat.

Why bother? Save yourself a ton of headaches and just let Tomcat serve everything.

Is there a reason you want to use Apache?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yichuan Wang
Greenhorn

Joined: Jan 17, 2008
Posts: 8
Originally posted by Bear Bibeault:

Why bother? Save yourself a ton of headaches and just let Tomcat serve everything.

Is there a reason you want to use Apache?

well, for solely test purpose , it is true that only Tomcat is sufficient. but don't most of ISP providers use Apache+Tomcat on their servers? If they do, why not we,
My question is that is it worth to do it?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

I can think of no reason to do this if you don't need Apache to do something that Tomcat cannot do.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Yichuan Wang:
My question is that is it worth to do it?


It used to be.
The earlier versions of Tomcat were not optimized for performance.

In the last few years enhancements in both Tomcat and the JVMs on which they run have improved so much that, depending on what your app does, running Tomcat as a standalone may actually be faster than connecting it to an external webserver.

Very recently, Tomcat has gained the ability to run with the Apache Portable Runtime libraries (APR) The APR is the core of the Apache Web Server, is written in C and can take advantage of things like kernel level file serving and kernel level socket handling.

My advice, try running with a standalone version of Tomcat.
If your app is suffering from performance problems look into all of the available means to improve it, including APR and running Tomcat behind and external web server.

Often, Tomcat's static file handling or SSL handling won't be your biggest bottleneck so adding and maintaining an external web server, and the connector (with all of its headaches) will gain you nothing. The cost of installing, configuring, and maintaining it may be more than what it would cost to improve your hardware or pay for a better network connection.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Also...
If you find a book or article on the web that advocates running Tomcat behind an external web server, check the date carefully. The arguments may have been very valid at the time that it was written.

A lot has changed.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

That's very perfect as Ben said. The recent versions of Tomcat have undergone certain improvements in performance.

So the later versions are well suited to sustain the earlier bottlenecks.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make Tomcat and Apache cooperate?