(source:
http://www.swm.com.cn)
J2EE gradually became industry standards under the efforts of companies such as Sun and IBM, and now there are dozens of J2EE application server providers. The most popular J2EE server quoted is $ 5000 (mid-range installation). SMEs and ordinary developers are unable to bear.
J2EE mainly includes the following specifications:
* Middleware (MiddleWare) includes components of Enterprise Java Bean (EJB) and Java Message Service (JMS).
* Name and directory JNDI (Java Naming and Directory Interface) APIs are used to find services and components.
* Representation server-side applet (servlet) and Java Server Page (JSP) support web / http browser access
* Transaction Java Transaction API (JTA) / Java Transaction Service (JTS).
For more information on J2EE, please refer to its homepage http://java.sun.com/j2ee/.
EJB is the most important component in the J2EE architecture, which is the core of the server-side distributed computing model. The EJB server is the container of EJB, controlling the operation of EJB, and provides important system-level services - transaction, security, remote access, database access, and more. This brings a simplification of application development, developing EJB according to EJB specification, running by EJB container, is responsible for transaction, security, and lifecycle. The structure of a typical J2EE multi-layer application is shown
1. The intermediate layer is the J2EE application server, including the web server and the EJB server. The web server includes a web container and a Web component (Servlet and JSP), and the EJB server includes EJB containers and EJB components. The client contains a variety of web browsers and applications, EIS for traditional databases and enterprise applications (ERP, etc.). The client program and the intermediate layer perform data exchange through the protocols such as HTTP, HTTPS, RMI, CORBA, and the intermediate layer is communicating with the EIS through JDBC.
The EJB server is an important part of the J2EE application server. Sun's J2EE SDK, IBM's WebSphere, BEA WebLogic, etc. J2EE implementation is included in an EJB server. There are also some J2EE specifications to be independent. Tomcat as mentioned in this series is the implementation of the web server. The JBoss introduced in this article is an independent EJB server implementation (JBoss's goal is an open J2EE environment, but now it is just a complete EJB. The server, integration with other web servers Tomcat, Jetty is also a direction).
EJB (Specification 1.0-2.0) can be divided into two types, session beans, and entity beans (Entity Beans).
Generally speaking, the session bean is used for commercial logic calculations, and entity beans are access to packaging databases. These two types of EJB must be selected according to different situations.
JBoss introduction
JBoss is open source, follow J2EE specification, 100% pure Java EJB server. More than 500 in JBoss's development teams, more than 50 core developers are J2EE experts. Tens of thousands of users in JBoss are all over the world. JBoss uses Java Manage Extension API to implement software modules integration and management (see Figure 2). For details on JBoss, please refer to its homepage http://www.jboss.org.
JBoss Suite consists of several modules (or APIs):
JBoss / Server JBOSS server, core is an EJB container, fully supporting EJB1.1 norms.
JBoss / Spydermq JMS's pure Java implementation supports JMS 1.0.2 specification.
JBoss / Jaws Just Another Web Storage, Jaws API implements mapping of Java objects and relational databases, and JBoss uses it to implement EJB continuity (Persistence). Jaws also adds the Connection Pooling module to improve access to the database.
JBoss / Zola Zola provides JBOSS case procedures to illustrate the development of J2EE applications and implementation in JBoss (deploy). ZOLA includes an example ZOL WebStore, which can be used as a web store, JSP, Servlet, EJB, to implement online shopping, supporting Web and WAP access.
JBoss / ZOAP supports Simple Object Access Protocol (SOAP) access, SOAP is a mobile exchange protocol proposed by Microsoft and IBM supporting world-wide distributed loosely coupled
The homepage of the SOAP specification is at http://www.w3.org/tr/2000/note-soap-20000508/.
JBoss / Castor is integrated with CASTOR, providing Java Data Object (JDO) support for new EJB continuous methods.
JBoss / Tomcat is integrated with Tomcat, providing a complete J2EE environment.
Tomcat's homepage is http://jakarta.apache.org/.
JBoss / Jetty is integrated with Jetty, providing a complete J2EE environment.
Jetty's homepage is http://jetty.mortbay.com/.
JBoss / Test JBOSS test environment.
JBoss use
JBoss is running requires JDK 1.2.2 or 1.3. Sun's JDK 1.3 is located at http://java.sun.com/j2se. Installing and using pure Java's JBoss is very simple, downloading binary versions from JBoss's homepage,
JBoss-2.0_final.zip Windows 32
JBoss-2.0_final.tar.gz UNIX / Linux
After direct decompression, present the following directory structure:
* bin - contains bootable JAR file run.jar and operating system-related startup scripts. Run.bat is Windows script, run.sh is a UNIX / Linux script.
* conf - contains the configuration files required by JBoss itself and other modules.
* DB - Data Stock & Profile DB.Properties.
* Deploy - Place the EJB-JAR file to this directory, implement EJB applications.
* DOCS - contains documents for JBoss / Server.
* DOCS / API - Javadoc documentation with JBoss / Server.
* lib - The JMX file required to include the bootstrap JAR file. * LIB / EXT - JBoss / Server runs other (JAR) files required. No need to configure, the Server boot script will automatically add them to classpath.
* log - Storage log file or profile log.properties.
* TMP - Store temporary files or profiles Tmp.properties.
The following is based on JBoss / Test, introducing the implementation of the EJB application.
About EJB books, you can refer to ED Roman's Master Enterprise JavaBeans - And The Java 2 Platform, Enterprise Edition (Willy, 1999, electronic version can download), and Richard Monson-Haefel Enterprise Enterprise JavaBeans, Second Edition (Oreilly, 2000).
Download JBoss / Test's source code jbosstest-cvs-sources.zip, unzipped into directory $ {jbtpath}. Set Java_Home points to the installation directory of the JDK and add $ {java_home} / bin to the system Path variable. Enter the directory $ {jbtpath} / src / build, run the corresponding script compile EJB application.
[Win32]
Set jbtpath = c: / jbosstest
Set java_home = c: /jdk1.3
SET PATH =% java_home% / bin;% PATH%
CD% JBTPATH% / SRC / Build
build
[UNIX / Linux Bash]
JBTPATH = / usr / local / jbosstest
Java_home = / usr / local / jdk1.3
PATH = $ java_home / bin: $ PATH
CD $ jbtpath / src / build
Build.sh
If successful, create a dist catalog in $ {jbtpath}, the structure is as follows:
BIN: The script containing the EJB client.
Deploy: Contains EJB-JAR that compiles generated, can be implemented in JBoss.
LIB: Contains files needed to run the client.
The EJB-JAR to $ {JBOSS_HOME} / deploy directory is completed in the DEBs_HOME} / deploy directory.
Confirm that Java_Home points to the JDK installation path, start the JBoss server, and then run the corresponding test script in $ {jbtpath} / dist / bin, you can observe the output of the client program.
JBoss and Web Server (Tomcat and Jetty)
Tomcat and Jetty are a web server that supports HTML / JSP / Servlet, integrating JBOSS as a complete product level J2EE server. Users can implement J2EE-EAR directly, not the previous implementation of EJB-JAR and Web-WAR, which are very convenient. JBoss and web servers are running in the same Java virtual machine, and servlet calls EJB without the network, thereby greatly improving operational efficiency and improving security performance.
summary
As a "third generation" application server, J2EE developers and users are rare teaching materials. Combined with the system of open source such as Linux, the server-side enterprise applications are not underestimated.