The Java EE 6 Tutorial

ProcedureTo Build, Package, Deploy, and Run the consumeremote Modules Using Ant

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

  1. Open the file tut-install/examples/jms/consumeremote/earthmdb/src/java/mdb/MessageBean.java in an editor.

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

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

  4. Go to the following directory:

    tut-install/examples/jms/consumeremote/earthmdb/
    
  5. Type the following command:


    ant
    

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

  6. Type the following command:


    ant deploy
    
  7. Go to the jupiterclient directory:


    cd ../jupiterclient
    
  8. Type the following command:


    ant
    

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

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

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