The Java EE 6 Tutorial

ProcedureTo Edit, Build, Package, Deploy, and Run the Clients Using Ant and the appclient Command

These steps assume that you have the tutorial installed on both of the two systems you are using and that you are able to access the file system of jupiter from earth or vice versa. You will edit the source files to specify the new connection factory. Then you will rebuild and run the clients.

  1. To edit the source files, follow these steps:

    1. On earth,, open the following file in a text editor:

      tut-install/examples/jms/simple/producer/src/java/Producer.java
      
    2. Find the following line:

      @Resource(lookup = "jms/ConnectionFactory")
    3. Change the line to the following:

      @Resource(lookup = "jms/JupiterConnectionFactory")
    4. On jupiter, open the following file in a text editor:

      tut-install/examples/jms/simple/synchconsumer/src/java/SynchConsumer.java
      
    5. Repeat Step b and Step c.

  2. To recompile and repackage the Producer example on earth, type the following:


    ant
    
  3. To recompile and repackage the SynchConsumer example on jupiter, go to the synchconsumer directory and type the following:


    ant
    
  4. On earth, deploy and run Producer. Follow these steps:

    1. On earth, from the producer directory, deploy the client JAR file to the GlassFish Server, then retrieve the client stubs:


      ant getclient
      

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

    2. To run the client, type the following:


      appclient -client client-jar/producerClient.jar queue 3
      
  5. On jupiter, run SynchConsumer. Follow these steps:

    1. From the synchconsumer directory, deploy the client JAR file to the GlassFish Server, then retrieve the client stubs:


      ant getclient
      

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

    2. To run the client, type the following:


      appclient -client client-jar/synchconsumerClient.jar queue