The Java EE 6 Tutorial

ProcedureTo Build, Package, Deploy, and Run the clientsessionmdb Example Using NetBeans IDE

  1. To compile and package the project, follow these steps:

    1. In NetBeans IDE, select File->Open Project.

    2. In the Open Project dialog, navigate to:

    3. Select the clientsessionmdb folder.

    4. Select the Open as Main Project check box and the Open Required Projects check box.

    5. Click Open Project.

    6. In the Projects tab, right-click the clientsessionmdb project and select Build.

      This task 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

  2. Right-click the project and select Run.

    This command deploys the project, returns a JAR file named clientsessionmdbClient.jar, and then executes it.

    The output of the application client in the Output pane looks like this (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 (domain-dir/logs/server.log), 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.