Chapter 5. Running Applications

Use WebSphere Application Server V6 to run J2EE applications

Testing artifacts on a server

You can use the server tools to test one or more application artifacts on an application server.

  1. In the Project Explorer view from the J2EE perspective, expand the project that contains the file you want to test.

  2. Right-click the artifact that you want to test. Examples of artifacts include the Web project or a file within the Web project (such as a JSP file, servlet, or HTML file), or an enterprise bean.

    JSP file

  3. Select Run > Run on Server. The Server Selection wizard appears.

  4. Use the radio buttons to specify how you want to select the server. Select from the following options:

    Select the server

    • Choose an existing server - This option uses an existing server that is defined in your workbench.

    • Manually define a server - This option creates a new server.

  5. Under the Select the server type list, select a server you want to run your application. The list of available servers, under the Select the server type list, depends on the J2EE specification level you defined for the artifact and the supported servers for this product.

  6. (Optional) Click Next to configure additional settings, such as configuring settings specific to the server:

    Configure additional settings

    and adding or removing projects configured on the server:

    Adding projects

  7. Click Finish. The server tools automatically complete the following tasks for you:

    • If the Create server resources in workspace check box on the Server preferences page (Windows > Preferences > Server) is enabled, the server tools creates a server project with Servers as the default name.

    • Creates the server and adds it to the Servers View.

    • Adds your project to the server.

    • Starts the server. (This may take time depending on the server settings.)

    • If the Automatically publish before starting servers check box on the Server preferences page (Window > Preferences > Server) is selected, the server tools check to see if your project and files on the server are synchronized. If they are not, the project and the files are automatically updated on the remote machine when the server is restarted.

    • If testing enterprise beans, the server tools display the enterprise bean in the Universal Test Client.

    • If testing Web artifacts, the server tools adds the EAR project containing your Web project to the server. And display the file in the Web Browser.

Setting publishing preferences for a WebSphere Application Server v6.0

Use the publishing settings to specify whether you want to publish your application on the server or run your application within the development environment without publishing to the server.

The setting Run server with resources on Server runs and publishes your application directly on a remote or local server. The setting Run with resources within the workspace runs your application in the workbench without publishing your application to a server. This mode of running your application is known as running your application on a server test environment.

To configure the publishing settings for WebSphere Application Server v6.x:

  1. In the Servers view, double-click your WebSphere Application Server v6.0 to open the server editor.

  2. Click the Overview tab.

  3. Expand the Publishing section.

  4. Use the radio buttons to select either the following:

    Publishing section

    • Run server with resources within the workspace

      Enables you to run your application from within the workbench without publishing to the server. You can enable the Run server with resources within the workspace check box when running a local server. This option is NOT available when running a remote server.

    • Run server with resource on server

      Publishes your application on the targeted server.

  5. In the Enable automatic publishing check box specify whether you want to enable the development environment to publish changes in your application from the workbench to the server.

  6. In the Publishing interval (in minutes) field, specify how long the development environment waits before publishing the changes in your application from the workbench with the server.

  7. Save and close the editor.

Professional hosting     Belorussian informational portal         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     Free SCWCD 1.4 Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide