Sun Microsystems Logo

 

 
 

Sun[tm] ONE Studio 4, Enterprise Edition for Java[tm] with Application Server 7 Tutorial
Deploying and Running the J2EE[tm] Application
PREV PREV NEXT

 

In this exercise you will first override the default value assigned to the context root of the web application. Then you will deploy and run the application.

  1. Undeploy EJB Test Application
  2. Define Web Context Root
  3. Deploy the Application
  4. Run the Application

1. Disable EJB Test Application

Since both the EJB Test and the JDBC Simple applications contain the same EJB module, if you attempted to deploy the JDBC Simple application without at least disabling the EJB Test application, a JNDI naming conflict would occur during deployment of the JDBC Simple application. This is because the <jndi-name> value of ejb/my-jdbc-simple as contained in the EJB module's deployment descriptor is scoped globally throughout the application server instance.

To disable the EJB Test application:

1. In the Explorer, select the Runtime tab and drill down to the server1(localhost:4848) node.

2. Expand the Deployed Applications node, select GreeterDB_TestApp, right-click and select Disable.

No JNDI naming conflicts will occur with a prior deployment of the JDBC Simple sample application because you changed the JNDI name of the EJB in the second version of this application to a unique value.

2. Define Web Context Root

The context root provides a way to distinguish resources of one web application from resources of other web applications deployed to the same server instance. You set the context root on the web module object that is represented in the J2EE application object. In this exercise, you will specify my-jdbc-simple as the context root. (If you set the context root to the same value as used by a previously deployed copy of the JDBC Simple sample, an error would occur during deployment because you cannot deploy two web applications with the same context root to the same virtual server).

The context root value determines how end users will access the web application:

http://hostname:port/my-jdbc-simple/...

To define the context root of the web module:

1. In the Explorer window, under the Filesystems tab, expand the jdbcSimpleApp node, select the jdbcSimpleWeb object, right-click and select Properties.

Note that we modify the context setting at the J2EE application level because a single module may be added to different J2EE applications. Each application may require different web context values even though the underlying web application is the same.

2. Type my-jdbc-simple in the Web Context field.

The property sheet looks like this:

3. Deploy the Application

To deploy the application, right-click the jdbcSimpleApp node and select Deploy.

Several views appear in the Output window while a Progress Monitor window shows the deployment progress. Wait for the Progress Monitor to close automatically.

You can monitor the status of the many operations in the IDE through the status area of the IDE's menu bar. As you deploy the application, you will see status information in this area.

4. Run the Application

Before running the application, make sure that the PointBase server is running.

To run the application:

1. Open a web browser window and access the following URL:

http://hostname:port/my-jdbc-simple/index.html

When the web browser connects to the server, the server1: access view tab in the output window displays a new line.

2. Enter a name and click Process in the web browser.

As the servlet, EJB, and JSP page are executed, the output of System.out.println statements are displayed in the server1: server.log view tab in the output window.

3. Click the here link to display a list of the greeting messages generated thus far.

More log entries appear in the server.log view window.

After having run the application successfully, proceed to Modifying the Application to gain a sense of the speed of typical development activities.

PREV PREV NEXT