Chapter 4. Using the Examples

Table of Contents

4.1. Compiling the Examples
4.1.1. Requirements
4.1.2. Compile
4.2. Running Examples
4.2.1. Stateless Session Bean
4.2.1.1. Description
4.2.1.2. Running the Server
4.2.1.3. Deploying the Bean
4.2.1.4. Running the Client
4.2.2. Stateful Session Bean
4.2.2.1. Description
4.2.2.2. Running the Server
4.2.2.3. Deploying the Bean
4.2.2.4. Running the Client
4.2.3. Entity Bean
4.2.3.1. Description
4.2.3.2. Running the Server
4.2.3.3. Deploying the Bean
4.2.3.4. Running the Client
4.2.3.5. Properties for the persistence
4.2.4. Message Driven Bean
4.2.4.1. Description
4.2.4.2. Running the Server
4.2.4.3. Deploying the Bean
4.2.4.4. Running the Client
4.2.5. Timer example
4.2.5.1. Description
4.2.5.2. Running the server
4.2.5.3. Deploying the Bean
4.2.5.4. Running the Client
4.2.6. Security example
4.2.6.1. Description
4.2.6.2. Running the Server
4.2.6.3. Deploying the Bean
4.2.6.4. Running the Client
4.2.7. Pool example
4.2.7.1. Description
4.2.7.2. Running the Server
4.2.7.3. Deploying the Bean
4.2.7.4. Running the Client
4.2.8. Migration EJB 2.1/3.0 example
4.2.8.1. Description
4.2.8.2. Running the Server
4.2.8.3. Deploying the Bean
4.2.8.4. Running the Client
4.2.9. EAR example
4.2.9.1. Description
4.2.9.2. Running the Server
4.2.9.3. Deploying the EAR
4.2.9.4. Using the Client

4.1. Compiling the Examples

4.1.1. Requirements

Before running the examples, be sure to follow the requirements for compiling and running these EasyBeans examples.

4.1.2. Compile

The ant tool is used to build the examples. To compile the examples, use the build.xml file that is located in the examples directory.

The command ant install_all_examples must be launched in the examples directory:

$ ant install_all_examples
Buildfile: build.xml

install_all_examples:

init-maven-task:

init:
    [mkdir] Created dir: /home/benoitf/workspace/easybeans/output/example-classes
    [mkdir] Created dir: /home/benoitf/workspace/easybeans/clients
    [mkdir] Created dir: /home/benoitf/workspace/easybeans/webapps

compile:
    [javac] Compiling 4 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/entitybean.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/entitybean.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-entitybean.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-entitybean.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 3 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/mdb.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/mdb.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-mdb.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-mdb.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 7 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/migration21.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/migration21.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-migration21.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-migration21.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 5 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/security.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/security.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-security.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-security.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 7 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/stateless.jar'.
[easybeans:ejb] Copying 5 files to /home/benoitf/workspace/easybeans/easybeans-deploy/stateless.jar

war:

war-standalone:
[easybeans:war] Building War in '/home/benoitf/workspace/easybeans/webapps/web.war'.
[easybeans:war] Copying 6 files to /home/benoitf/workspace/easybeans/webapps/web.war/WEB-INF/classes
[easybeans:war] Copying 1 file to /home/benoitf/workspace/easybeans/webapps/web.war/WEB-INF

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-stateless.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-stateless.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 3 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/stateful.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/stateful.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-stateful.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-stateful.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 6 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:
[easybeans:ejb] Building Ejb in '/home/benoitf/workspace/easybeans/easybeans-deploy/timer.jar'.
[easybeans:ejb] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/timer.jar

war:

ear:

client:

client-standalone:
[easybeans:client] Building Client in '/home/benoitf/workspace/easybeans/clients/client-timer.jar'.
[easybeans:client] Building jar: /home/benoitf/workspace/easybeans/clients/client-timer.jar

install:

init-maven-task:

init:

compile:
    [javac] Compiling 5 source files to /home/benoitf/workspace/easybeans/output/example-classes

ejb:

ejb-standalone:

war:

war-standalone:

ear:
[easybeans:ear] Building Ear in '/home/benoitf/workspace/easybeans/easybeans-deploy/ear3.ear'.
      [ejb] Building Ejb in '/tmp/easybeans-ant33717.tmp'.
      [ejb] Building jar: /tmp/easybeans-ant33717.tmp
      [war] Building War in '/tmp/easybeans-ant33718.tmp'.
      [war] Building war: /tmp/easybeans-ant33718.tmp
[easybeans:ear] Building jar: /home/benoitf/workspace/easybeans/easybeans-deploy/ear3.ear

client:

install:

BUILD SUCCESSFUL
Total time: 22 seconds

The examples are copied under the easybeans-deploy/ folder of the project and are available for the deployment.

[Note] Note

If the EasyBeans server is running, it will detect these new applications and deploy them automatically.