The Java EE 6 Tutorial

ProcedureTo Build, Package, Deploy, and Run the clientsessionmdb Example Using Ant

  1. Go to the following directory:

    tut-install/examples/jms/clientsessionmdb/
    
  2. To compile the source files and package the application, use the following command:


    ant
    

    The ant command creates the following:

    • An application client JAR file that contains the client class file and the session bean’s remote interface, along with a manifest file that specifies the main class and places the EJB JAR file in its classpath

    • An EJB JAR file that contains both the session bean and the message-driven bean

    • An application EAR file that contains the two JAR files

    The clientsessionmdb.ear file is created in the dist directory.

  3. To deploy the application and run the client, use the following command:


    ant run
    

    Ignore the message that states that the application is deployed at a URL.

    The client displays these lines (preceded by application client container output):

    To view the bean output,
     check <install_dir>/domains/domain1/logs/server.log.

    The output from the enterprise beans appears in the server log file, wrapped in logging information. The Publisher session bean sends two sets of 18 messages numbered 0 through 17. Because of the message selector, the message-driven bean receives only the messages whose NewsType property is Sports or Opinion.