The Java EE 6 Tutorial

ProcedureTo Build, Package, Deploy, and Run the consumeremoteModules Using NetBeans IDE

To edit the message-driven bean source file and then package, deploy, and run the modules using NetBeans IDE, follow these steps.

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

  2. In the Open Project dialog, navigate to:


    tut-install/examples/jms/consumeremote/
    
  3. Select the earthmdb folder.

  4. Select the Open as Main Project check box.

  5. Click Open Project.

  6. Edit the MessageBean.java file as follows:

    1. In the Projects tab, expand the earthmdb, Source Packages, and mdb nodes, then double-click MessageBean.java.

    2. Find the following line within the @MessageBean annotation:

              @ActivationConfigProperty(propertyName = "addressList",
                  propertyValue = "remotesystem"),
    3. Replace remotesystem with the name of your remote system.

  7. Right-click the earthmdb project and select Build.

    This command creates a JAR file that contains the bean class file.

  8. Select File->Open Project.

  9. Select the jupiterclient folder.

  10. Select the Open as Main Project check box.

  11. Click Open Project.

  12. In the Projects tab, right-click the jupiterclient project and select Build.

    This target creates a JAR file that contains the client class file and a manifest file.

  13. Right-click the earthmdb project and select Deploy.

  14. To copy the jupiterclient module to the remote system, follow these steps:

    1. Change to the directory jupiterclient/dist:


      cd ../jupiterclient/dist
      
    2. Type a command like the following:


      cp jupiterclient.jar F:/
      

      That is, copy the client JAR file to a location on the remote filesystem. You can use the file system user interface on your system instead of the command line.

  15. To run the application client, follow these steps:

    1. Go to the directory on the remote system (jupiter) where you copied the client JAR file.

    2. To deploy the client module and retrieve the client stubs, use the following command:


      asadmin deploy --retrieve . jupiterclient.jar
      

      This command deploys the client JAR file and retrieves the client stubs in a file named jupiterclientClient.jar

    3. To run the client, use the following command:


      appclient -client jupiterclientClient.jar
      

      On jupiter, the output of the appclient command looks like this (preceded by application client container output):


      Sending message: This is message 1 from jupiter
      Sending message: This is message 2 from jupiter
      Sending message: This is message 3 from jupiter

      On earth, the output in the server log looks something like this (preceded by logging information):


      MESSAGE BEAN: Message received: This is message 1 from jupiter
      MESSAGE BEAN: Message received: This is message 2 from jupiter
      MESSAGE BEAN: Message received: This is message 3 from jupiter