Chapter 4. Deploying Your Applications

4.1. Deploying Applications to a Local Server

In order to deploy applications to a server from within the IDE, you must configure the IDE with information about the server. For a local server this information includes the following:

  • A server runtime environment with details about the server location, runtime JRE, and configuration files
  • A server adapter with management settings for the server runtime environment, including access parameters, launch arguments, and publishing options

JBoss Server Tools enables you to efficiently configure a local server ready for use with the IDE using Runtime Detection. As demonstrated here, this feature is useful for quickly configuring a server for deploying and testing an application.

Procedure

4.1.1. Configuring the IDE for a Local Runtime Server

Runtime Detection searches a given local system path to locate certain types of runtime servers. For any servers found, Runtime Detection automatically generates both a default server runtime environment and a default server adapter. These items can be used as they are for immediate application deployment or customized to meet your requirements.

Procedure

To configure the IDE for a local runtime server:

  1. Click Window > Preferences.
  2. In the Preferences window, locate and click JBoss Tools > JBoss Runtime Detection.
  3. Click Add.
  4. Locate the directory containing the runtime server and click OK.
  5. In the table of located runtimes, ensure the runtime is selected and click OK.
  6. Click Apply and Close to close the Preferences window. A default runtime environment and server adapter are generated for the server, with the server adapter listed in the Servers view.

4.1.2. Deploying an Application

When you have configured the IDE for the server, you can deploy applications to the server from the IDE using the server adapter. The server adapter enables runtime communication between the server and IDE for easy deployment of applications and server management.

Procedure

To deploy an application to the server:

  1. In the Project Explorer view, right-click {project name} and click Run As > Run on Server.
  2. Ensure Choose an existing server is selected.
  3. From the table of servers, expand localhost, select the server on which to deploy the application and click Finish. The Console view shows output from the server starting and deploying the application. When deployment is complete, an IDE default web browser opens and shows the deployed web application.

4.1.3. Changing and Republishing the Application

By default, the server adapter configures the server for automatic publishing when changed resources are saved. This automatic publishing action applies to application resources that can be interchanged in the dedicated deployment location of the server without requiring the application to stop and restart, such as .html files. For other changed resources, such as .java files, you need to republish the application such that it forces a rebuild of the application.

Procedure

To republish the application to the server after changes that cannot be automatically published:

  1. In the Servers view, expand the server adapter to list the applications allocated to the server.
  2. Right-click {application name} and click Full Publish. The Console view shows the output from the server replacing the deploying application. Unless LiveReload is enabled in the web browser, you must manually reload the web browser to see the changed application.

Additional Resources

  • You can also configure servers by right-clicking the Servers view and selecting New > Server or by clicking Manually define a new server in the Run on Server wizard.
  • Paths previously searched by Runtime Detection can be automatically searched on every workspace start. Click Window > Preferences > JBoss Tools > JBoss Runtime Detection and from the Paths table select the check boxes of the appropriate paths. Click Apply and click OK to close the Preferences window.
  • You can customize the server adapter and server runtime environment with the Server Editor. In the Servers view, double-click the server adapter to open the Server Editor.
  • You can initiate download and installation of runtime servers from the IDE. Click Window > Preferences > JBoss Tools > JBoss Runtime Detection. Click Download and from the table of runtime servers select the one to install and click Next. Follow the on-screen instructions to complete the download and installation process.

4.2. Configuring a Remote Server

Remote servers allow developers to access and deploy to a JBoss instance that is not a local machine. Developers can use remote servers to set up multiple environments for development and testing purposes and share them with other developers. Another reason to use a remote server with Red Hat Developer Studio is to allow developers to share and deploy automated tests to run in a non-local environment.

Procedure

4.2.1. Setting up a Remote Server

Procedure

The following instructions are used to set up a remote server for JBoss Enterprise Middleware application servers. A complete server definition requires a server adapter (or server) that allows the IDE to communicate with and manage the remote server.

  1. Click the Servers view. If the Servers view is not visible, click Window > Show View > Server.
  2. Use the appropriate instructions depending on the number of existing servers listed in the Servers tab:

    1. If there are no existing servers, click No servers are available. Click this link to create a new server.
    2. If there are one or more existing servers, right-click an existing server and click New > Server.
  3. In the New Server wizard:

    1. From the Select the server type list, select a JBoss Enterprise Middleware application server.
    2. The Server’s host name and Server name fields are completed by default. In the Server name field, you can type a custom name to later identify the server in the Servers view.
    3. Click Next to continue.

      Figure 4.1. Defining a New Remote Server

      Defining a New Remote Server
  4. Configure the required Server Adapter details:

    1. In The server is list, click Remote.
    2. In the Controlled by list, click either Filesystem and shell operations or Management Operations depending on your requirement.

      Note

      If you select Management Operations in the Controlled by list, you must set up an administrator user on the server by using the $SERVER_HOME/bin/add-users.sh script for Linux, or the $SERVER_HOME\bin\add-users.bat file for Windows, and enter the same credentials in the server editor or during the server start.

    3. Click the Server lifecycle is externally managed. check box to deploy the server but to not expect the IDE to stop or start the server.
    4. Clear the Assign a runtime to this server check box to create a remote server without assigning a runtime to it.

      Note

      Creating a Remote Server without a runtime results in limitations. For example, the JMX connection does not work because it requires libraries from the runtime to connect via JMX. Additionally, automatic port detection occurs using the standalone.xml file, which is not available if a runtime is not specified. These and other minor issues related to hard-coded minor fixes in maintenance releases may occur if no runtime is specified for the Remote Server.

  5. From the drop-down list, click the relevant runtime server and click Next.

    Figure 4.2. Creating a New Server Adapter

    Creating a New Server Adapter
  6. Add the remote system integration details as follows:

    1. In the Host field, the default host is Local. If required, click New Host to create a new host, which may be remote or local. Supported connection types for remote hosts are FTP Only or SSH Only.
    2. In the Remote Server Home field, specify a path to the directory that contains the remote server.
    3. In the Remote Server Base Directory field, specify the remote server’s base directory (the default value for this is the standalone directory within the server home directory).
    4. In the Remote Server Configuration File field, specify the file to use for the remote server’s configuration (the default value for this is the standalone.xml file). This location is within the Remote Server Home directory (specifically in the $SERVER_HOME/$BASE_DIRECTORY/configuration/ directory).
    5. Either click Next to continue to the (optional) next step to add or remove server resources or click Finish to conclude the new remote server configuration.

      Figure 4.3. Connect to a Remote System

      Connect to a Remote System
  7. Optional: Add or remove resources configured on the server as follows:

    1. To add a resource, select the appropriate resource in the Available pane and click Add. To add all available resources, click Add All.
    2. To remove a resource, select the appropriate resource in the Configured pane and click Remove. To remove all configured resources, click Remove All.
    3. Click Finish to complete the server configuration.

      Figure 4.4. Add and Remove Server Resources

      Add and Remove Server Resources

      Result: You have successfully configured a remote server. The new server is listed in the Servers view. Right-click the server to view operations, including Start to start the server.

Note

If the Server lifecycle is externally managed. check box was selected in the steps above, clicking Start does not start the server. Instead, it marks the server to indicate that it has started and the web poller checks whether the server is running.