Chapter 1. Introduction to EJB

Table of Contents

1.1. Overview
1.2. Components
1.3. EJB Environment and Configuration
1.3.1. Directory Structure
1.3.2. XML Configuration File
1.3.3. Related Tools
1.4. EJB Basic Settings

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 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).

Note

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.


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.

bin

The directory where scripts for launching tools, that are used to help the administrator manage EJBs, are stored. These tools are: jeusadmin and appcompiler.

domains/<domain name>/config

The most important configuration files of JEUS system. This directory contains the domain.xml file.

domains/<domain name>/servers/<server name>/logs

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.

domains/<domain name>/.application/

The archive files of applications used by domains are copied and decompressed to this directory. It contains EJB implementation classes and helper classes.

FileDescription
<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.

lib/schemas

The schema files relating to EJB are located in each directory as shown below.

Sub directoryDescription
javaeeContains all Java EE XML schema files related to EJB.
jeusContains all JEUS XML schema files related to EJB.
samples/ejb

Contains several sub-directories and sample code, demonstrating the implementation of various types of EJBs.

Note

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.

Note

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:

Note

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.

  1. Make sure that JEUS has been properly installed on the system.

  2. 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. 

    Note

    [3] represents the log level, CONFIG. It is only displayed when the specified log level is higher than CONFIG.

  3. 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.

    Note

    Modifying the MS setting using the tool provided by JEUS is possible only when DAS is running.

  4. Open another command prompt and enter the following. (Host information is that of DAS.)

    $ jeusadmin -host localhost:9736
    User name:
  5. Enter your administrator user name and password (as configured during JEUS installation).

    User name: administrator
    Password:
  6. 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. 
  7. 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
  8. 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
  9. The entire JEUS system has been terminated now.