Some suggestions for J2EE application deployment (1)

zhaozj2021-02-16  58

Original address: http://www.onjava.com/pub/a/onjava/2003/06/11/j2ee_deployment.html?page=1

1. Introduction: Now you have some J2EE developers with some qualifications, most of them are happy to provide you with some different types of EJB details, or how to use JMS to send and accept asynchronous messages. However, it is difficult to find someone to describe a system architecture that ensures testability, reliability, and good performance. Many J2EE programmers lack in-depth understanding. One reason is that the deployment of the application contained in the J2EE Spectation is very little. Remove this problem to your personal consideration. So this has led to many confuses, such as each designer has a way to deploy J2EE applications. In this article, we must first introduce different J2EE modules and different packaging structures. We will then explore some feasible deployment structures and some deployment techniques in the design and implementation of the J2EE application.

By this more, you'd better know some J2EE core technology, such as JSP, servlet, ejb, xml.

1.1J2EE Modules. J2EE 1.3 Supports packaging J2EE Application into different deployable modules. Here are the two J2EE Modules Application Modalone Modules (EJB or Resource Adapter) basically, a WAR file (Web Application Archive) It is used to deploy a web-based Application. The WAR file can contain servlets, HTML files, JSPs, and everything and related maps or resource files. On the other hand, an EAR file is a container that can include the EJBS resource adapters, and one or more Web Application modules. When you pack the Enterprise Application, you need to think about this Application requires this. How many EAR files. Do you want to include all my EJBS to EAR files? These decisions will directly affect the running stability, maintenanceability, and execution of the program. Let's explore these, 1.2-type loader relationships (ClassLoader Relationship) often in designing J2EE Application we have ignored relationships between different module types. Java Virtual Machine (JVM) uses class loader ClassLoader to find classes and objects and put them like memory. By default, the system's class loader loads the class based on the location of the ClassPath in the system, of course, can also provide other parts of the place, not by default.

Figure 1 Interpretation of the type of gear 1. Loading the Server of the application end with SystemClassLoader and can only see resources from the ClassPath through the system. Each EAR and RAR and RAR and WAR modules have separate ClassLoaders. The relationship between the ClassLoaders loader does not have a clear determination, but there is a relationship in 4 different type loaders in four different types of loadors, just like the relationship between subclasses and parent classes, as a subclass ClassLoader can locate the ClassLoad in the ClassLoad in the parent class. But it can't. In J2EE, SystemLoader is all the parent class ClassLoader of EarclassLoader. However, EAR ClassLoader is the parent class ClassLoader of WAR and RAR. figure 2

According to Java specification, a subclass-loader must be positioned with its parent classLoader before trying to locate your own class. This is not necessary, but this is a conflict between multiple class loaders (ClassLoader) between multiple classes to be loaded in the same JVM. There are individual application servers to allow you to selectively find the load behavior of the EAR and WAR type loaders. But do not recommend this, as this may cause other troubles, such as ClassCastException happens in the case: When two identical Version classes but in different class loaders. 2 Deployment Architecture, a typical 3-layer Enterprise Application consists of three main layers. Expression layer: The task of this layer is responsible for processing interaction with the user. Business Logic Layer: This layer is usually playing the role of Server, responsible for responding to a request from the user's expression layer. Data layer: This layer contains a database and other components of the connection database. In a large commercial system, each layer will be individually deployed in its own domain, which allows each domain to meet your business needs. In addition, the load balancer will be deployed before the expression layer used to improve reliability and support better Fail-Over, business logic and data layer tendency to prevent Fail-over, explained below. Typical deployment structure. image 3

According to the real business use case, there are some changes in the above figure.

For a J2EE-Application, the expression layer is usually solved by using servlet and JSP, and these servlets and JSPs can be packaged into one or more WAR files. Business layers are usually implemented by Session Beans, and these Beans can be packaged as one or more EAR files. The data layer is typically through entity Beans (Entity Beans) (usually used to connect to the database) or the resource adapter (controlling the connection with Lagacy and non-JBDC resources, the same can, of course, can be packaged as one or more EAR files. The picture shows us the same deployment structure in the J2EE resource and model.

If you deploy a J2EE Application in accordance with the model above, there is a good flexibility, but there are some other needs to take into account before the deployment structure is formed.

转载请注明原文地址:https://www.9cbs.com/read-22865.html

New Post(0)