Tomcat is an application server bottom line.
But is it a webserver?
Well, web server is something which serves static web pages.
Java application server is run by Java virtual machine and it allows you to use servlets, Java server pages, all that which is called Enterprise java.
In general application server is a part of the general picture:Database —- Application server — webserver —– client browserTomcat and other appservers can actulaly combine two central parts (which are called mid-tier), but it is preferable to have a separate web server specializing on static pages.
It could be used as both or either, but most commonly the webserver part is fulfilled by something like Apache. ‘Application’ was originally used to mean EJBs but has since come to mean any server side code that is Java-driven that can be deployed as a war (and mostly everything is) to the likes of Tomcat
First the facts, neither is better. As mentioned, Tomcat provides a servlet container that supports the Servlet specification (Tomcat 7 supports Servlet 3.0). JBoss, a full fledged application server supports Java EE 6 (including Servlet 3.0) in its current version. Tomcat is fairly lightweight, so if you need certain JEE features beyond the Servlet API, you can easily enhance Tomcat. For example, if you need JPA features you can include Hibernate or OpenEJB and JPA works nearly out of the box.When starting your project you should have an idea what it requires. If you’re in a large enterprise environment JBoss (or any other JEE server) might be the right choice as it provides built-in support. E.g:
JMS messaging for asynchronous integration
Web Services engine (JAX-WS and/or JAX-RS)
Management capabilities like JMX and a scripted administration interface
Advanced security, e.g. out-of-the-box integration with 3rd party directories
EAR file instead of “only” WAR file support all the other “great” JEE features I can’t remember :-)In my opinion Tomcat is a very good fit if it comes to web centric, user facing applications. If backend integration comes into play, a JEE application server should be (at least) considered. Last but not least, migrating a WAR developed for Tomcat to JBoss should be a 1 day excercise.
Unlike most application servers, Tomcat is also a web server. It has the Apache web server embedded in it (full web server, but not all the apache extra features).The reasons to look at having a separate web server from Tomcat are for high-traffic sites where performance is better if static pages are served by a simpler piece of technology like Apache, or if you plan to add other types of dynamic app pages like PHP or .Net.
Whatever their purpose, such server-side programs generate a response, most often in HTML, for viewing in a Web browser.Understand that a Web server’s delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it.
The Web server doesn’t provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging.
While a Web server may not itself support transactions or database connection pooling, it may employ various strategies for fault tolerance and scalability such as load balancing, caching, and clustering—features oftentimes erroneously assigned as features reserved only for application servers.
The application serverAs for the application server, according to our definition, an application server exposes business logic to client applications through various protocols, possibly including HTTP. While a Web server mainly deals with sending HTML for display in a Web browser, an application server provides access to business logic for use by client application programs. The application program can use this logic just as it would call a method on an object (or a function in the procedural world).
Such application server clients can include GUIs (graphical user interface) running on a PC, a Web server, or even other application servers. The information traveling back and forth between an application server and its client is not restricted to simple display markup. Instead, the information is program logic. Since the logic takes the form of data and method calls and not static HTML, the client can employ the exposed business logic however it wants.In most cases, the server exposes this business logic through a component API, such as the EJB (Enterprise JavaBean) component model found on J2EE (Java 2 Platform, Enterprise Edition) application servers.
Moreover, the application server manages its own resources. Such gate-keeping duties include security, transaction processing, resource pooling, and messaging. Like a Web server, an application server may also employ various scalability and fault-tolerance techniques. Here are very interesting link on the differences between Application server and webserver.