[Reprinted] J2EE Overview

Source: Internet
Author: User
Tags perl script
This article provides a comprehensive introduction to J2EE in five aspects. Starting from the concept of J2EE, to its advantages, to the typical J2EE layer-4 model, and its framework structure, it is finally an introduction to the thirteen core technologies of J2EE. This article gives a detailed introduction to J2EE services, components, layers, containers, and APIs in different categories. I believe that after reading this article, readers will have a clearer understanding of J2EE.

1. J2EE Concept
Currently, the Java 2 platform has three versions. These are the micro version of Java 2 platform (Java 2 platform Micro Edition, j2_based) applicable to small devices and smart cards) java 2 platform Standard Edition (Java 2 platform Standard Edition, j2se) for desktop systems and Java 2 Platform Enterprise Edition (J2EE) for creating server applications and services ).
J2EE is an architecture that uses the Java 2 platform to simplify the development, deployment, and management of enterprise solutions. The foundation of J2EE technology is the Standard Edition of the core Java platform or Java 2 platform. J2EE not only consolidates many advantages of the Standard Edition, for example, the features of "writing once and running anywhere", jdbc api for convenient database access, and the technology of CORBA, as well as the security mode that can protect data in Internet applications, etc, it also provides comprehensive support for EJB (Enterprise JavaBeans), Java Servlets APIs, JSP (Java Server Pages), and XML technologies. The ultimate goal is to become an enterprise developer who can greatly shorten the time to launch the product to the market.
Architecture.
The J2EE architecture provides an intermediate layer integration framework to meet the needs of applications that require high availability, high reliability, and scalability without too much cost. By providing a unified development platform, J2EE reduces the cost and complexity of developing multi-tier applications. It also provides strong support for existing application integration and fully supports Enterprise JavaBeans, A good wizard supports packaging and deploying applications, adding directory support, enhancing the security mechanism and improving performance.

Ii. Advantages of J2EE
J2EE provides a good mechanism for building a business system with scalability, flexibility, and maintainability:
Reserve existing IT assets: As enterprises must adapt to new business needs, it is important to use existing investment in enterprise information systems rather than re-develop overall solutions. In this way, a server-side platform mechanism built on an existing system is required by the company in a gradual (instead of radical, totally no) manner. The J2EE architecture can take full advantage of users' original investments, such as BEA Tuxedo, IBM CICs, IBM encina, Inprise VisiBroker, and Netscape application server used by some companies. This may be because J2EE has extensive industry support and the participation of some important vendors in the 'Enterprise compute' field. Every supplier provides existing customers with a way to upgrade to the portable J2EE field without having to discard existing investments. Because J2EE-based products can run on almost any operating system and hardware configuration, the existing operating system and hardware are also
Can be reserved for use.
Efficient development: J2EE allows companies to deliver some common and tedious server tasks to middleware vendors. In this way, developers can focus on how to create business logic and shorten the development time accordingly. Advanced middleware vendors provide the following complex middleware services:
Status Management Service-allows developers to write less code without worrying about how to manage the status, so as to complete program development faster.
Continuous service-allows developers to write applications without coding the data access logic and generate more
Lightweight, database-independent applications, which are easier to develop and maintain.
Distributed Shared data object cache service-enables developers to compile high-performance systems, greatly improving the overall deployment
Scalability.
Support for heterogeneous environments: J2EE can be used to develop portable programs deployed in heterogeneous environments. J2EE-based applications do not
Depends on any specific operating system, middleware, and hardware. Therefore, a reasonably designed J2EE-based program only needs to be developed once.
It can be deployed on various platforms. This is critical in a typical heterogeneous enterprise computing environment. The J2EE standard also allows
Customers order third-party ready-made components compatible with J2EE and deploy them in heterogeneous environments, saving themselves
Cost of developing the entire programme.
Scalability: enterprises must select a server-side platform that provides excellent scalability to meet a large number of new customers who perform business operations on their systems. Applications based on the J2EE platform can be deployed on various operating systems. For example, it can be deployed to high-end Unix and mainframe systems, which can support 64-256 processors on a single machine. (This is beyond the reach of NT servers) suppliers in the J2EE field provide more extensive Load Balancing policies. Eliminate system bottlenecks and allow integrated deployment of multiple servers. This deployment can reach thousands of processors, achieving highly scalable systems to meet the needs of future commercial applications.
Stable availability: A server platform must run around the clock to meet the needs of customers and partners. Because the Internet is global and ubiquitous, even if it is stopped at night, it may cause serious losses. If an unexpected shutdown occurs, there will be disastrous consequences. J2EE is deployed in a reliable operating environment. They support long-term availability. Some J2EE instances are deployed in windows, and customers can choose Operating Systems with better performance, such as Sun Solaris and ibm OS/390. The most robust operating system can achieve 99.999% availability or only 5 minutes of downtime per year. This is an ideal choice for real-time commercial systems.

Iii. J2EE layer-4 Model
J2EE uses a multi-layer distributed application model. The application logic is divided into components based on their functions.
The layers are distributed on different machines. In fact, Sun designed J2EE to solve the two-layer mode (Cl
The disadvantages of ient/Server). In the traditional mode, the client is bloated with too many roles.
Medium, the first deployment is relatively easy, but it is difficult to upgrade or improve, scalability is not ideal, and often
Based on a proprietary protocol-usually a database protocol. It makes the reuse of business logic and interface logic very
Difficult. The multi-tier enterprise application model of J2EE divides different layers of the two-tier model into multiple layers. One
Multi-layer applications can provide an independent layer for different services. The following is a typical layer-4 Structure of J2EE:
Customer layer components running on client machines
Web layer components running on the J2EE Server
Business logic layer components running on the J2EE Server
Enterprise information system layer software running on the EIS Server
J2EE application components
J2EE applications are composed of components. J2EE components are software units with independent functions.
And files are assembled into J2EE applications and interacted with other components. The following J2EE components are defined in the J2EE specification.
:
The application client and applets are customer-layer components.
Java Servlet and JavaServer Pages (JSP) are web layer components.
Enterprise JavaBeans (EJB) is a service layer component.
Customer layer components
J2EE applications can be web-based or traditional.
Web layer components J2EE Web layer components can be JSP pages or Servlets. According to J2EE specifications, static html pages

And applets are not web layer components.
As shown in the customer layer, the web layer may contain some JavaBean objects to process user input and
Input and send to the enterprise Bean running on the business layer for processing.
Business Layer Components
The logic of the business layer code is used to meet the needs of special business fields such as banking, retail, and finance.
The enterprise Bean
This process can also be reversed when receiving, processing (if necessary), and sending data to the EIS layer for storage.
Line.
There are three enterprise-level beans: session beans, entity beans, and message-driven (MES)
Sage-driven) Beans. Session Bean indicates temporary interaction with the client program. After the client program is executed
The Session Bean and related data will disappear. On the contrary, the Entity Bean indicates a permanent record in a table in the database.
When the client program is terminated or the server is closed, there will be potential services to ensure that the data of the entity bean can be saved.
The message-driven bean combines the features of the Session Bean and the message listener of JMS, allowing a service layer component to be different
Step to receive JMS messages.
Enterprise information system layer
Enterprise information system layer processing enterprise information system software includes enterprise infrastructure construction systems such as enterprise resource planning (ERP)
, Mainframe transaction processing, database systems, and other legacy information systems. For example, the J2EE application component may be
The database connection needs to access the enterprise information system.
Iv. J2EE Structure
This component-based, platform-independent J2EE structure makes the compilation of J2EE programs very simple, because the business
The logic is encapsulated into reusable components, and the J2EE server provides backend Services for All component types in the form of containers.
Service. Because you do not need to develop such services on your own, you can concentrate on solving business problems at hand.

Containers and services
Container settings customize the internal support provided by the J2EE server, including security, transaction management, and JNDI (Java Nami
Ng and Directory Interface) Addressing, remote connection and other services, the following lists the most important services:
The J2EE Security model allows you to configure Web components or enterprise beans, so that only authorized
Users can access system resources. Each customer belongs to a special role, and each role can only activate a specific role.
. You should declare the role and the method that can be activated in the layout description of enterprise Bean. Because of this sound
You do not have to write security-enhancing rules.
The J2EE transaction management model allows you to specify
In this way, all the methods in a transaction are treated as a single unit.
The method in SE bean. The container is involved in a management transaction. Because there are container management transactions, not in enterprise Bean
The transaction boundary must be encoded. Code that requires control of distributed transactions is complex. You only need to describe
Declare the transaction attributes of the enterprise Bean in the file, instead of writing and debugging complex code. The container will read this article
And process the transactions of this enterprise Bean for you.
The JNDI Lookup service provides a unified interface for multiple enterprise names and directory services.
The sample application component can access the name and directory service.
J2EE remote connection (remote client connectivity) model management between the client and enterprise Bean
Low-layer interaction. After an enterprise Bean is created, a client can call its method just like it and the customer
The client is located on the same virtual machine.
Life Cycle Management (life cycle management) model management enterprise Bean creation and removal,
Enterprise Bean will go through several statuses in its lifecycle. Create an enterprise Bean in the container and
Move the available instance pool and activity status, and finally remove it from the container. Even if you can call Enterprise
The create and remove methods of bean, the container will also execute these tasks in the background.

The database connection pool (pooling) model is a valuable resource. Obtain Database
Connection is a time-consuming task, and the number of connections is very limited. Containers mitigate these problems by managing the connection pool.
Enterprise bean can quickly obtain connections from the pool. When the bean releases the connection, it can be used by other beans.
Container Type
The J2EE application components can be installed and deployed in the following containers:
The EJB container manages the execution of enterprise-level beans in all J2EE applications. Enterprise beans and their capacity
Is running on the J2EE server.
Web containers manage the execution of JSP pages and Servlet components in all J2EE applications. Web components and their capacity
Is running on the J2EE server.
Application client container manages the execution of application client components in all J2EE applications.
The user and their containers run on the J2EE server.
The applet container is a combination of Web browsers and Java Plug-ins running on client machines.
V. Core APIs and components of J2EE
The J2EE platform consists of a complete set of services, application interfaces (APIS), and protocols.
Multi-tier Web applications provide Function Support. The following describes 13 technical specifications in J2EE (limited
Length, which can only be briefly described here ):
JDBC (Java database connectivity ):
JDBC APIs provide a unified way to access different databases. Like ODBC, JDBC shields developers.
In addition, jdcb's database access is platform-independent.
JNDI (Java name and Directory Interface ):
The jndi api is used to run the name and directory services. It provides a consistent model to access and operate enterprise-level resources.
Such as DNS and LDAP, local file system, or objects on the application server.

EJB (Enterprise JavaBean ):
One of the reasons why J2EE technology has won widespread attention is EJB. They provide a framework for development and implementation.
The distributed business logic greatly simplifies the development of enterprise-level applications with scalability and high complexity.
. The EJB specification defines when and how the EJB component interacts with their containers. Containers provide public
Services, such as directory service, transaction management, security, resource buffer pool, and fault tolerance. However, it is worth noting that
Yes. EJB is not the only way to implement J2EE. Because of the openness of J2EE, some vendors can
In parallel with EJB to achieve the same purpose.
RMI (Remote Method invoke ):
As its name indicates, the RMI protocol calls methods on remote objects. It uses the serialization method on the client
And the server. RMI is a more underlying protocol used by EJB.
Java IDL/CORBA:
With the support of Java IDL, developers can integrate Java and CORBA. They can create Java
Or they can create Java classes and expand them together with other ORBs.
. The latter method provides another way through which Java can be used
Applications and old systems.
JSP (Java Server Pages ):
A JSP page consists of HTML code and Java code embedded in it. After the server is requested by the client on the page
The Java code is processed and then the generated HTML page is returned to the browser of the client.
Java Servlet:
Servlet is a small Java program that extends the functions of web servers. As a server-side application
The execution starts when the request is sent, which is similar to the cgi Perl script. Most of the functions provided by Servlet are similar to those provided by JSP.
But the implementation method is different. JSP usually embeds a small amount of Java code in most HTML code, while Servlet

S is all written in Java and HTML is generated.
XML (Extensible Markup Language ):
XML is a language that can be used to define other Markup languages. It is used to share data in different business processes.
The development of XML and Java are mutually independent. However, the same objective of XML and Java is platform independence. Pass
By combining Java and XML, you can get a perfect platform-independent solution.
JMS (Java Message Service ):
Ms is an application interface (API) used to communicate with message-oriented middleware ). It supports point-to-point domains, including
Supports publish/subscribe domains and supports the following types:
Message transmission, transactional message transmission, consistent message, and persistent subscriber support. JMS also provides
One way to integrate your application with the old background system.
JTA (Java transaction architecture ):
JTA defines a standard API, which allows the application system to access various transaction monitoring data.
JTs (Java Transaction Service ):
JTs is the basic implementation of the transaction monitoring function of CORBA ots. JTs specifies the implementation method of the Transaction Manager. This transaction management
Java transaction API (JTA) specification is supported at the high-level level, And omg ots specif is implemented at a lower level
Java image of ication. The JTs Transaction Manager is an application server, resource manager, independent application, and communication.
Resource Manager provides transaction services.
Javamail:
Javamail is an API used to access the mail server. It provides a set of abstract classes for the mail server. Not only supports s
The MTP server also supports the IMAP server.
JTA (JavaBeans activation framework ):
Javamail uses JAF to process MIME-encoded email attachments. Mime byte streams can be converted to Java objects, or

References:
Develop N-tier Application Using J2EE-Steven gocould
The business benefits of EJB and J2EE technologies over com + and Windows d
Na
The J2EE tutorial Chapter overview-Monica pawlan
The image used in this article is modified from an English image in the J2EE tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.