Building, Packaging, Deploying, and Running the Application


The source code for the Coffee Break application is located in the directory <INSTALL>/javaeetutorial5/examples/coffeebreak/. Within the cb directory are subdirectories for each web applicationcb, cb-saaj, and cb-jaxwsand a directory, cb-common, for classes shared by the web applications. Each subdirectory contains a build.xml file. The web application subdirectories in turn contain a src subdirectory for Java classes and configuration files, and a web subdirectory for web resources.

Setting the Port

The JAX-WS and SAAJ services in the Coffee Break application run at the port that you specified when you installed the Application Server. The tutorial examples assume that the Application Server runs on the default port, 8080. If you have changed the port, you must update the port number in the following files before building and running the examples:

  • <INSTALL>/javaeetutorial5/examples/coffeebreak/cb-common/src/com/sun/cb/common/CoffeeBreak.properties. Update the port in the following URLs:

    • endpoint.url=http://localhost:8080/jaxws-coffee-supplier/jaxws

    • saaj.url=http://localhost:8080/saaj-coffee-supplier

Building, Packaging, and Deploying the JAX-WS Service

To build the JAX-WS service and client library and to package and deploy the JAX-WS service using NetBeans 5.5, follow these steps:

1.

In NetBeans 5.5, choose Open Project from the File menu.

2.

In the Open Project dialog, navigate to <INSTALL>/javaeetutorial5/examples/coffeebreak/.

3.

Select the cb-jaxws folder.

4.

Select the Open as Main Project and Open Required Projects checkboxes.

5.

Click Open Project Folder.

6.

Right-click the cb-jaxws project and choose Build Project.

7.

Right-click the cb-jaxws project and choose Deploy Project.

To build the JAX-WS service and client library and to package and deploy the JAX-WS service using Ant, follow these steps:

1.

In a terminal window, go to <INSTALL>/javaeetutorial5/examples/coffeebreak/cb-jaxws/.

2.

Run ant. This task calls the default target, which compiles the source files of the JAX-WS service.

Ignore the error issued by the wsimport-client-generate target.

3.

Make sure the Application Server is running.

4.

Deploy the JAX-WS service:

ant deploy


Building, Packaging, and Deploying the SAAJ Service

To build the SAAJ service and client library and to package and deploy the SAAJ service using NetBeans 5.5, follow these steps:

1.

In NetBeans 5.5, choose Open Project from the File menu.

2.

In the Open Project dialog, navigate to <INSTALL>/javaeetutorial5/examples/coffeebreak/.

3.

Select the cb-saaj folder.

4.

Select the Open as Main Project and Open Required Projects checkboxes.

5.

Click Open Project Folder.

6.

Right-click the cb-saaj project and choose Build Project.

7.

Right-click the cb-saaj project and choose Deploy Project.

To build the SAAJ service and client library and to package and deploy the SAAJ service using Ant, follow these steps:

1.

In a terminal window, go to <INSTALL>/javaeetutorial5/examples/coffeebreak/cb-saaj/.

2.

Run ant. This task calls the default target, which creates the client library and compiles the SAAJ service classes.

3.

Make sure the Application Server is started.

4.

Deploy the SAAJ service:

ant deploy


Building, Packaging, and Deploying the Coffee Break Server

To build, package, and deploy the Coffee Break server using NetBeans 5.5, follow these steps:

1.

In NetBeans 5.5, choose Open Project from the File menu.

2.

In the Open Project dialog, navigate to <INSTALL>/javaeetutorial5/examples/coffeebreak/.

3.

Select the cb folder.

4.

Select the Open as Main Project and Open Required Projects checkboxes.

5.

Click Open Project Folder.

6.

Right-click the cb project and choose Build Project.

7.

Right-click the cb project and choose Deploy Project.

To build, package, and deploy the Coffee Break server using Ant, follow these steps:

1.

In a terminal window, go to <INSTALL>/javaeetutorial5/examples/coffeebreak/cb/.

2.

Run ant. This task calls the default target, which compiles the server classes.

3.

Make sure the Application Server is started.

4.

Deploy the Coffee Break server:

ant deploy


Running the Coffee Break Client

After you have installed all the web applications, check that all the applications are running in the Admin Console. You should see cb, cb-saaj, and cb-jaxws in the list of applications.

You can run the Coffee Break client by opening this URL in a web browser:

   http://localhost:8080/cbserver/


A page appears with the following message:

   Redirecting to CoffeeBreak demo...click here otherwise.


In a few seconds, you should see a page like the one shown in Figure 361.

Figure 361. Order Form


After you have gone through the application screens, you will get an order confirmation that looks like the one shown in Figure 362.

Figure 362. Order Confirmation


Removing the Coffee Break Application

To remove the Coffee Break application, perform the following steps:

1.

Undeploy the JAX-WS service, SAAJ service, and the Coffee Break server using the Admin Console or by running ant undeploy in their respective directories.

2.

Stop the Application Server.

If you want to remove the build and dist directories, run ant clean in each directory, including <INSTALL>/javaeetutorial5/examples/coffeebreak/cb-common/.



The JavaT EE 5 Tutorial
The JavaT EE 5 Tutorial
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 309

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net