Table of Contents
This chapter describes the components and characteristics of EJB, and how to install EJB and to configure its environment.
JEUS supports JSR 318 Enterprise JavaBeansTM 3.1 (hereafter EJB 3.1). EJB 3.1 specification (hereafter EJB specification) describes architecture for creating fully portable business components. This greatly simplifies the development efforts when implementing complex, mission-critical, and performance sensitive business logic.
According to the EJB specification, the following is the concept of Enterprise JavaBeans (EJB).
“The Enterprise JavaBeans architecture is component architecture for the development and deployment of component-based distributed business applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure. These applications may be written once, and then deployed on any server platform that supports the Enterprise JavaBeans specification.”
The JEUS WAS represents one such "server platform" mentioned in the excerpt.
This manual will describe how EJB is implemented in JEUS, and about additional functions that are essential in an enterprise environment.
For more information on how to implement the specification, refer to the "JEUS Introduction".
For increased performance and reliability, the JEUS implementation offers two non-standard features through clustering:
Load-balancing for better performance
Failover for increased reliability
Both of these functions require the clustering of two or more Managed Servers (hereafter MS).
Clustering of EJB will be discussed in "Chapter 6. EJB Clustering". For information on MS clustering, refer to JEUS Domain Guide. "Chapter 5. JEUS Clustering".
The following figure shows main components of EJB implementation entity.
Refers to the EJB container described in EJB 3.1. It provides a runtime environment for deployed EJB modules. The EJB engine will be described in detail in "Chapter 2. EJB Engine".
Used to group and manage a set of Enterprise JavaBeans as a single unit. EJB module is the unit used to assemble, deploy, and control EJB in JEUS. Therefore, all EJBs must be part of an EJB module. The EJB module will be described in detail in "Chapter 3. EJB Module".
Represents the actual business components of an EJB module. For information on common characteristics of EJB components, refer to "Chapter 4. Common Characteristics of EJB".
The following are the five types of EJB components. For more detailed information, refer to the following chapters:
Stateless Session Bean : "Chapter 7. Session Bean"
Stateful Session Bean : "Chapter 7. Session Bean"
BMP Entity Bean : "Chapter 8. Entity Bean"
CMP 1.1 & CMP 2.x Entity Bean : "Chapter 8. Entity Bean"
Entity Bean is replaced by JPA from EJB 3.0. For more information, refer to the "JEUS JPA Guide".
This section describes configuration elements related to JEUS EJB, such as the directory structure, EJB configuration files, and various tools. It also describes system properties related to EJB and their characteristics.
The following shows the directories and files related to JEUS EJB.
The directory where scripts for launching tools, that are used to help the administrator manage EJBs, are stored. These tools are: jeusadmin and appcompiler.
The most important configuration files of JEUS system. This directory contains the domain.xml file.
The directory where the log files of EJB engine are stored. If a separate file handler is specified, a separate file will be created, otherwise, the setting in the server log configuration file will be followed.
The archive files of applications used by domains are copied and decompressed to this directory. It contains EJB implementation classes and helper classes.
File | Description |
---|---|
<EAR archive file> | The EAR application configuration file is copied to the directory named EAR application-id. |
<EJB archive file> | The EJB module configuration file is copied to the directory named EJB module-id. |
The schema files relating to EJB are located in each directory as shown below.
Sub directory | Description |
---|---|
javaee | Contains all Java EE XML schema files related to EJB. |
jeus | Contains all JEUS XML schema files related to EJB. |
Contains several sub-directories and sample code, demonstrating the implementation of various types of EJBs.
The bracket expressions used in the above directory list (such as "<server name>/”) means that the string in between the brackets must be replaced with an actual system or configuration dependent value. For instance, if the current machine is called server1, the corresponding JEUS MS must also be called server1. Thus the "<server name>/" expression is replaced with the actual directory name of "server1/" on the actual system.
The following XML configuration files pertain to the management and configuration of JEUS EJB. The contents of the previous files must always start with a standard JEUS-defined XML header. The XML schema files are located in the JEUS_HOME/lib/schemas/jeus/directory. And the root element should specify the namespace of JEUS XML schema as the current namespace.
Configuration file where EJB engines are added. For more information, refer to "JEUS Server Guide" and "Chapter 2. EJB Engine".
Main EJB engine configuration file. For more information, refer to the EJB 3.1 specification.
Location
The standard JAR file within its META-INF directory
XML header of ejb-jar.xml
The XML header of ejb-jar.xml is included in the EJB standard.
[Example 1.2] XML Header : <<ejb-jar.xml >>
<?xml version="1.0"?> <ejb-jar version="3.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
jeus-ejb-dd.xml (jeus-ejb-dd.xsd)
Configures JEUS Deployment Descriptors (hereafter DD) for JEUS EJB module. For more information, refer to "Chapter 3. EJB Module".
The order of all tags used in the manual follows the order of the XML schema configuration file. Refer to the Reference Book for more information on tag ordering. But since it is not easy to maintain the order in actual use, JEUS provides automatic function for ordering tags. This eliminates the need to consider the order when writing XML configuration file.
When an XML example from any of these files is used in this manual, the standard header will usually be omitted. You must make sure that these headers are included in the actual XML configuration files.
The following tools may be used to manage EJB engines, modules, and components:
Console Tool (jeusadmin)
The tool used to control and to monitor EJB engines. For more information, refer to JEUS Reference Book. "4.2.7. EJB Engine Commands" .
WebAdmin
The graphical administration tool of the JEUS product suite. It supports all the tasks of jeusadmin. For more information, refer to the "JEUS WebAdmin Guide".
For more information on appcompiler for EJB 2.x, refer to JEUS Reference Book. "4.3. appcompiler".
This section describes the installation steps for using EJB in JEUS.
In the following example, we shall assume that the EJB engine is configured on the server named server1.
Make sure that JEUS has been properly installed on the system.
Execute the command screen and enter the following command in the $JEUS_HOME/bin directory to start DAS.
$ startDomainAdminServer -domain domain1 -u administrator -p passsword1 -verbose . . . [2012.05.06 21:33:15][2] [adminServer-1] [SERVER-0248] The JEUS server is STARTING. . . . [2012.05.06 21:33:16][3] [adminServer-1] [Security-0082] The JEUS security manager started. . . . [2012.05.06 21:33:16][3] [adminServer-1] [SERVER-0173] The JNDI naming server started. . . . [2012.05.06 21:33:28][2] [launcher-10] [Launcher-0034] The server[adminServer] initialization completed successfully[pid : 2380]. [2012.05.06 21:33:28][0] [launcher-1] [Launcher-0040] Successfully started the server. The server state is now RUNNING.
[3] represents the log level, CONFIG. It is only displayed when the specified log level is higher than CONFIG.
Click [Servers] on the WebAdmin screen. The Server page will appear.
To configure an EJB engine, click an MS from the list of servers and then click [Engine] > [Ejb Engine] > [Basic]. If not specified, the EJB engine will be operated according to the default settings.
Modifying the MS setting using the tool provided by JEUS is possible only when DAS is running.
Open another command prompt and enter the following. (Host information is that of DAS.)
$ jeusadmin -host localhost:9736
User name:
Enter your administrator user name and password (as configured during JEUS installation).
User name: administrator Password:
At the command line, enter the following. The server will start.
$ startManagedServer -domain domain1 -server server1 -u administrator -p passsword1 -verbose ... [2012.05.07 14:10:10][2] [server1-1] [SERVER-0248] The JEUS server is STARTING. ... [2012.05.07 14:10:17][2] [server1-1] [SERVER-0248] The JEUS server is RUNNING.
Enter 'help' to get a list of commands that can be used to monitor and control the EJB engine.
[DAS]domain1.adminServer>help -g EJB
[ EJB]______________________________________________________________________
cancel-ejb-timer Cancels active EJB timers.
ejb-timer-info Lists the active EJB timers. If no options are
specified, a list of all EJB modules that
containtimers will be displayed.
modify-active-management Modify the active management configuration.
modify-check-resolution Set the check resolution of the EJB engine on the
server.
show-active-management Shows the active management of the EJB engine on
the server.
show-check-resolution Shows the check resolution of the EJB engine on
the server.
To show detailed information for a command, use 'help [COMMAND_NAME]'.
ex) help connect
Enter stop-server(stop server) → local-shutdown(stop DAS) → exit(stop tool) in at the command line.
[DAS]domain1.adminServer>stop-server server1 Server [server1] was successfully stopped. [DAS]domain1.adminServer>local-shutdown The server [adminServer] has been shut down successfully. offline>exit
The entire JEUS system has been terminated now.
For more information on installation and settings, refer to the "JEUS Installation and Getting Started Guide" and the "JEUS Server Guide".