In this post i’ll discuss about Apache Tomcat Web Server and look in to its extent for support in J2EE Environment.
Apache Tomcat is one of the most popular options for lightweight development scenarios,and in many cases meets the need for an application server, even though it is technically a Web server.Java EE extends Java Platform, Standard Edition (Java SE) to support Web services, an enterprise component model, management APIs, and communication protocols for designing and implementing service-oriented architectures, distributed applications, and Web applications.
A compliant Java EE application server must support features such as an Enterprise JavaBeans (EJB) server and container; JNDI capabilities; a Java Message Service (JMS) framework; a Java Transaction API (JTA) framework; and J2EE Connector Architecture. Java EE servers usually support a hierarchical classloader architecture enabling such functionality as EJB loading/reloading, WAR loading/reloading, manifest-specified utilities, and so on.
Java EE defines containers for client applications, servlets, and EJB components. These containers provide structure and functionality that facilitate the deployment, persistence, and execution of supported components. The J2EE Connector Architecture enables a provider of an enterprise system to expose the system using a standard interface known as a resource adapter.
Using a Java EE server(Application Server) gives you the convenience of hosting a system in a pre-tested environment that offers all of the Java enterprise development services. In some cases, however, the Java EE server brings unnecessary overhead to an execution environment that only requires one or two of these services.
For instance, many Java-based Web applications are deployed to environments that only support the technologies found in a Web server/container, such as servlets, JSPs, and JDBC. In these scenarios you might choose to construct a system piecemeal, using sundry frameworks and providers.
Some developers would choose to use Tomcat in place of the Java EE application server given these environmental constraints.
Web applications vs. enterprise applications
For some, the confusion over Tomcat’s definition points to the deeper question of what differentiates an enterprise application from a Web application. Traditionally, a Java enterprise application is defined as a combination of the following components and technologies:
- EAR files
- Java Servlets
- JavaServer Pages or JavaServer Faces
- Enterprise JavaBeans (EJB)
- Java Authentication and Authorization Service (JAAS)
- J2EE Connector Architecture
- JavaBeans Activation Framework (JAF)
- Java Message Service (JMS)
- Java Persistence API (JPA)
- Java Transaction API (JTA)
- The Java Management Extensions (JMX) API
- Java API for XML Processing (JAXP)
- The Java API for XML-based RPC (JAX-RPC)
- The Java Architecture for XML Binding (JAXB)
- The SOAP with Attachments API for Java (SAAJ)
- Java Database Connectivity (JDBC) framework
A Java Web application, meanwhile, is said to combine a subset of Java enterprise application components and technologies, namely:
- WAR files
- Java Servlets
- JavaServer Faces or JavaServer Pages
- Java Database Connectivity (JDBC) framework
In a typical Java EE Web application, an HTML client posts a request to a server where the request is handled by the Web container of the application server. The Web container invokes the servlet that is configured to handle the specific context of the request.
Once the servlet has received the initial request, some form of request dispatching ensues in order to perform the necessary business logic for completing the request. One or more business services or components are then invoked to perform business logic.
Most business services or components require access to some form of data storage or information system. Oftentimes an abstraction layer between the business service and the data store is provided in order to protect against future changes in the data store. DAOs (data access objects) are often employed as data abstraction components in this situation.
When the DAO invocation step is complete, the response data is passed back up the chain of command, usually as one or more Java beans. The Java beans are then passed to some type of state machine and/or view manager in order to organize and format the markup response. When processing is complete for a given request, a formatted response is passed back to the HTML client.
Now, suppose we add a requirement to the application for asynchronous messaging between business service components. In a Java-based system, this would typically be handled using the Java Message Service (JMS) as shown in figure :
Most Web servers do not offer JMS as a standard feature, but it is simple enough to add a JMS implementation to a Web server environment.
The application scenario depicted in Figure above could be handled quite easily with just a Web server providing a servlet engine and JSP engine.
Now we add the requirement for connectivity between business services and disparate enterprise information systems. Java EE offers the Java Connector Architecture as a common standard to meet this challenge.
The architecture is now approaching a complexity that is arguably better suited for a Java EE application server.
A Web server such as Tomcat could possibly be used in combination with other frameworks to meet the requirements, but system management and monitoring complications might make the server/framework mix impractical.
Figure presents a moderately complex, Java-based, service-oriented architecture employing all of the technologies along with communication between multiple WAR deployments, EJBs, and Web services.
The architecture in Figure above has entered the realm of complexity that requires a tested, scalable, manageable Java EE enterprise application server. Once again, a development team with the proper skill level could use Tomcat for the Web tier and piece together technologies and frameworks to support the business and data tiers.
What i personally feel is to support this type of architecture using web server is Impractical. But Most of the tasks that are involved in J2EE environment can be supported by Apache Tomcat Web Server !!
Java Tutorials by Ashutosh Sharma, please visit :