The component technologies of J2EE facilitate the development of J2EE components. These technologies are offered as a set of distributed system APIs that are specified by Sun via the Java Community Process (JCP) and are open to vendors, including Sun, for implementation. These APIs include:
Remote Method Interface (RMI): For distributed object communications
Enterprise JavaBeans are the central theme for J2EE. EJBs comprise Java's middle-tier server-side component model. All the other APIs exist to provide connectivity to and from EJBs.
Where do all the J2EE components exist in a distributed application?
J2EE is a true n-tier architecture; however, the different components developed on the J2EE framework can be grouped into server-side and client-side components. Applets and application clients are basically pure client-side components and execute in a virtual machine on the client machine. Applets execute in a browser, while applications can execute in other client-side processes.
J2EE offers two types of Web components: servlets and JSPs. The purpose of both types of components is the same: to serve up dynamic content to Web clients. In fact, JSPs are compiled into servlets during execution. This means that JSPs and servlets get requests from Web clients and serve back HTML (or XML). Servlets and JSPs provide the connectivity between the client- and server-side components in a J2EE application. To generate the right response, they can communicate with back-end data sources through JDBC, RMI, JMS, or JavaMail, as well as to middle tier Java components, namely, EJBs. In turn, EJBs can communicate with back-end sources.
EJBs are Java's server-side components. EJB components are developed to model business logic for an application. EJBs can leverage other APIs to connect to and communicate with back-end systems. There are two types of EJBs - session beans, which are associated with the lifetime of a user session, and entity beans, which are associated with server-side business objects that are persisted in a database and live beyond the life of user sessions.
What Are J2EE Containers and What is Their Relation to Application Server Vendors?
A J2EE component needs an execution environment to run in. J2EE containers are runtime hosts for J2EE components. Since there are basically two types of middle-tier J2EE components (Web components and EJBs), there are two types of J2EE containers - Web component containers and EJB containers.
Web component containers are basically servlet engines, JSP engines, and Web containers. A servlet container provides network services for servlet execution, such as support for HTTP, and other request-response protocols. JSP containers are basically servlet containers with the additional functionality of compiling JSP pages into servlets. As mentioned above, JSPs become servlets at runtime. Web containers provide the additional functionality of access to other J2EE APIs, such as RMI and JDBC.
EJB containers provide the runtime life-cycle management environment for EJB components. This includes EJB instantiation, communication, persistence, and transaction management, as well as access to other J2EE APIs, such as RMI and JDBC.
Application server vendors such as WebSphere, BEA, iPlanet, and ATG provide implementations of the J2EE service APIs and the containers in which components built on these APIs can execute. Since there are different types of J2EE containers, there are different J2EE container providers. This means that you can buy the Web and EJB containers from different sources and make them communicate by using standard J2EE services. For example, a JRun servlet engine from Macromedia should be able to work with an EJB container from WebLogic.