Chapter 1. Introduction to EJBs

Table of Contents

1.1. Overview
1.2. Components
1.3. EJB Environment and Configuration
1.3.1. EJB Environment and Configuration
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.

1.1. Overview

JEUS supports JSR 345 Enterprise JavaBeansTM 3.2 specification (hereafter EJB specification), which describes architecture for creating fully portable business components. The architecture 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 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.”

JEUS represents one such "server platform" mentioned in the excerpt.

This manual describes how EJB is implemented in JEUS, and about additional functions that are essential in an enterprise environment.

Note

For more information about 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).

Note

Clustering of EJB will be discussed in "Chapter 6. EJB Clustering". For information about MS clustering, refer to JEUS Domain Guide. "Chapter 5. JEUS Clustering".

1.2. Components

The following figure shows main components of an EJB implementation entity.

[Figure 1.1] Main Components of an EJB Implementation Entity

Main Components of an EJB Implementation Entity


1.3. EJB Environment and Configuration

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.

1.3.1. EJB Environment and Configuration

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.

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>EAR application configuration file is copied to the directory named EAR application-id.
<EJB archive file>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.

1.3.2. XML Configuration File

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.

  • domain.xml (jeus-domain.xsd)

    Configuration file where EJB engines are added. For more information, refer to "JEUS Server Guide" and "Chapter 2. EJB Engine".

    • Location

      JEUS_HOME/domains/<domain name>/config
    • XML header of domain.xml

      [Example 1.1] XML Header: <<domain.xml>>

      <?xml version="1.0"?>
      <domain version="8.0" xmlns="http://www.tmaxsoft.com/xml/ns/jeus"> 


  • ejb-jar.xml (ejb-jar_3_2.xsd)

    Main EJB engine configuration file. For more information, refer to the EJB 3.2 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.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                              http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.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 Modules".

    • Location

      The standard JAR file within its META-INF directory 
    • XML Header of jeus-ejb-dd.xml

      [Example 1.3] XML Header: <<jeus-ejb-dd .xml>>

      <?xml version="1.0"?>
      <jeus-ejb-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="8.0">


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

1.3.3. Related Tools

The following tools may be used to manage EJB engines, modules, and components:

Note

For more information about appcompiler for EJB 2.x, refer to JEUS Reference Book. "4.3. appcompiler".

1.4. EJB Basic Settings

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
    . . .
    [2016.08.06 21:33:15][2] [adminServer-1] [SERVER-0248] The JEUS server is STARTING.
    . . .
    [2016.08.06 21:33:16][3] [adminServer-1] [Security-0082] The JEUS security manager started.
    . . .
    [2016.08.06 21:33:16][3] [adminServer-1] [SERVER-0173] The JNDI naming server started.
    . . .
    [2016.08.06 21:33:28][2] [launcher-10] [Launcher-0034] The server[adminServer] initialization completed successfully[pid : 2380].
    [2016.08.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.

    [Figure 1.2] EJB Engine Setting

    EJB Engine Setting


    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 
    ...
    [2016.08.07 14:10:10][2] [server1-1] [SERVER-0248] The JEUS server is STARTING.
    ...
    [2016.08.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.

Note

For more information about installation and settings, refer to the "JEUS Installation and Getting Started Guide" and the "JEUS Server Guide".