Using MyEclipse Application Servers

MyEclipse includes more than 50 server connectors for application deployment during development. This tutorial provides you with some basics on MyEclipse application servers. You will learn how to:

  • Define a new server
  • Install a third-party server extension
  • Deploy a project
  • Publish applications
  • Operate a the server and use debugging features
  • Customize server configurations

Duration Time: 20 Minutes

Start Tutorial Now

Don't have MyEclipse? Download Now

1. Defining New MyEclipse Application Servers

Defining a new server allows you to select the server connector you want to use, provide configuration information, and choose projects to deploy to the server.

  1. Click new_server_icon on the Servers view toolbar. Alternatively, right-click the Servers view, and select New>Server.
    MyEclipse application servers
    Available application servers
  2. Select the server connector and version to configure.

    Note: If the server you want to configure is not in the list, you can install any WTP server connector by clicking the Download Additional Server Adapters link. See Installing a Third-Party Server Extension.

    Choosing Glassfish 3 connector
  3. Accept localhost as the host name or you can provide the fully qualified DNS name or IP address of the host machine.
  4. Accept the default server name or enter a new name. The server name identifies the server in the Servers view.
  5. Accept the default Create a new runtime environment option for first-time connector setup, and click Next. For subsequent server connector setup, see Working with Custom Server Connector Configurations.

    Example Glassfish connector configuration page
  6. Enter the runtime environment information, including the path to the server installation.
  7. In the Configured JRE drop-down, the default JRE is the default JRE for the workspace. Select an installed JRE to be used for launching the application server. See Defining a New JRE Installation to add an installed JRE.

    Note: For third-party server connectors, such as Apache Tomcat or IBM's Liberty Profile, you have an option to download and install the server and connector. This requires an active connection to the internet.

    Download and install option
  8. Click Next, and accept the defaults based on your selected server installation.

    Configuration defaults
  9. Click Next to select projects to configure on the server.

    Adding projects to the server
  10. Click Finish. The server is configured and appears in the Servers view.

    New server in the Servers view

1.1 Defining a New JRE Installation

The JRE installation is used by the connector to launch the application server instance. If you have previously configured a JDK installation, you can select it from the Configured JRE drop-down list in the new runtime environment configuration; otherwise, continue reading to configure a new JRE installation. The default JRE name lists only the JRE used to launch MyEclipse, which is insufficient for supporting the requirements of most  application servers.

  1. Click Installed JREs on the runtime environment configuration page.
  2. Click Add. Note that while the fields of this window refer to the a JRE environment, the objective is to specify the location of a full JDK as the runtime environment, not the default JRE provided by Sun Microsystems.
  3. Select the JRE type you want to add to the workspace, and click Next.
  4. In the JRE home field, browse for and select the root folder of your JDK installation folder, not the JRE folder it contains.
  5. Enter a name in the JRE name field, and click Finish.

    Adding a JDK
  6. Select the newly configured JDK from the Configured JREs drop-down, and continue with the server configuration.

    Selecting an installed JDK
Note: Your application server might require additional configuration steps. See Working with Custom Server Connector Configurations for how to customize the connector's launch configuration as needed. Please review all settings, as they affect the proper launch and operation of your application server.

2. Installing a Third-Party Server Extension

Out of the box, MyEclipse provides server connectors for many popular application servers. However, if the server you want to configure is not in the connector list, you can install any WTP server extension. The example below demonstrates installing the WebSphere Liberty Profile extension into MyEclipse without WebSphere support. MyEclipse with WebSphere support contains a MyEclipse version of the WebSphere Liberty Profile connector by default.

Note: Installing third-party server extensions requires an active connection to the internet.

  1. Click new_server_icon on the Servers view toolbar. Alternatively, right-click the Servers view, and select New>Server.

    Defining a new server
  2. Click the Download additional server adapters link. This requires an active connection to the internet.
  3. Select WebSphere Application Server v8.5 Liberty Profile Tools, and click Next.

    Adding the Liberty Profile extension
  4. Accept the license agreement, and click Finish. The server support will be downloaded and installed, and you are prompted to restart when complete.

    Connector extension installed
From this point, you can continue with the steps for defining a new server using the installed third-party server connector.

3. Deploying a Java EE Project to an Application Server

During initial server configuration, you can specify existing Java EE projects to run on the server. After a server is configured, you can manually or automatically deploy projects to a server.

3.1 Manual Deployment

There are several ways to deploy a project manually:

  • Drag a project to a server in the Servers view
  • Right-click a project and select MyEclipse>Add and Remove Project Deployments from the menu
  • Click the Manage Deployments icon on the main toolbar
  • Right-click a server in the Servers view, and select Add/Remove Deployments
  • Click the Add/Remove Deployments icon on the Servers view toolbar.

The steps below demonstrate using the right-click context menu in the Servers view.

  1. Right-click the server you want to deploy to, and select Add/Remove Deployments.
  2. Select projects to configure on the server. When supported by the server connector, you have the option to choose either exploded or packaged deployment by using the drop-down beside the module in the Configured column.

    Adding a project to the server
  3. Click Finish. 

    Project added to the server

3.2 Automatic Deployment

If you don't want to manually manage your project deployments or server running state, use Automatic deployment to let MyEclipse handle these for you.

  1. To enable Automatic deployment, right-click your project, and select either Run As> or Debug As>MyEclipse Server Application.

    Setting Automatic deployment
  2. Select the application server on which you want to run your project (or configure a new server connector), and click OK. MyEclipse automatically deploys your application to the selected application server, and then starts or republishes that server for you. Only applicable servers appear in the list.

    Note:
    In the project preferences (MyEclipse>Server Deployment), you can choose an app server to always deploy the project to when using the Run (Debug) As menu.

    Selecting a server to which you want to deploy

In the Servers view, you can expand the the application server on which you ran your project to see the deployments registered with it. In the application server Console view, you likely see log messages reflecting the application server status and the new deployment sent to it.

Expanded server showing deployments

    If the deployment mode is Exploded Archive, you can discover the deploy location by hovering over the deployed application in the Servers view.

    Viewing deployment information

    3.3 Removing a Deployment

    Remove a deployment by using either the Delete icon on the toolbar or the Add and Remove right-click context menu option in the  Servers view.

    To remove a deployment (undeploy) using the  Servers view toolbar, select the  deployment you want to remove, and click .

    Removing a deployment using the Servers view

    Using the menu, right-click the project, and select Add/Remove Deployment. Select the project you want to remove, click Remove, and click Finish.

    Removing a deployment with the Add and Remove window

    The project shuts down and is uninstalled from your server instance. As a last step, MyEclipse deletes the deployment from the server. The server logs these activities and issues to the Console view.

    Server log in the Console view

    4. Publishing Applications on the Server

    Publishing syncs up all deployed projects on the server with the associated resource files. When you add projects to a server, whether it is during server configuration or later, the project is not necessarily published on the server. Publishing can be done either with the server running or stopped. When you start a server, deployed applications automatically sync by default. The Servers view displays the status of Republish if applications are out of sync. You can change the default publish behavior in the server configuration file.

    Note: When you deploy a project using the Run As (or Debug As)>MyEclipse Server Application, the project is deployed and published simultaneously.

    To publish applications on a server, select a server in the Servers view, and click on the Servers view toolbar. 

    When you remove a project from a running server, publish happens automatically, removing the project and sync'ing all other projects deployed to the server. If you remove a project when the server is stopped, it is not technically removed from the server until the server starts again or until you manually publish the server.

    Publishing syncs only project changes to the application server. If you want fresh deployments, you can use the Clean operation by right-clicking the server and selecting Clean (redeploy) from the menu. This removes all deployed applications, and redeploys the projects in their entirety.

    5. Application Server Operation and Debugging

    From the Servers view, click to launch the selected server in the Run mode, the icon to launch the selected server in Debug mode, or the icon to launch in Profile mode. Alternatively, click the drop-down arrow on the MyEclipse toolbar, and select [your server]>Start, Debug, or Profile (if applicable) from the menu.

    Starting an app server from the toolbar

    The application server connector redirects the application server's stdout and stderr streams to the Console view. Monitor the console for server start-up  problems. The image below illustrates a successful startup of Tomcat.

    Successful Tomcat startup process

    5.1 Opening a Deployed Web Project in the Browser

    After deploying your project, launch the web application by opening the Servers view. Right-click a deployed web project or web module (if it is part of an EAR), and select Open in web browser.

    Opening a deployed project in the browser

    This action saves you from having to remember the URL for your application that usually takes the form below:

    http://<hostname>:<default port>/<web context root for project>

    You don't have to remember the port or hostname your server is running on, and by using the Open in Browser action, the correct URL opens in the MyEclipse Web Browser automatically.

    Project application displayed in the browser

    5.2 Debugging a Deployed Application

    MyEclipse extends the Eclipse debugger platform to support JSP breakpoints and debug actions. Debugging a deployed Java EE application is similar to debugging a standard Java application. 

    From either the Java or JSP source editor, you enter breakpoints in the left margin. During application server execution when execution control encounters a breakpoint, the Debug perspective is invoked and debug information displayed. The application server must be launched in Debug mode for breakpoints to be enabled and execution to halt in a breakpoint context. See JavaScript Development and Debugging for more details about debugging applications.

    JSP debugging session

    5.3 Stopping an Application Server

    From the Servers view, click  to terminate the server's execution. Alternatively, click the drop-down arrow  on the main toolbar, and select [your server]>Stop. The application server connector begins the shutdown process for the application server instance.


    Initiating Tomcat shutdown

    As the application server terminates, you can observe thread termination of the application server's process. In many cases, shutdown progress messages from the application server are output to the Console view. The image below depicts a successful Tomcat server shutdown. Notice that Tomcat process threads have been terminated.

    Tomcat shutdown

    6. Working with Custom Server Connector Configurations

    Occasionally, you might have a need to launch an application server with an alternative configuration. In such cases, it is possible to create a second server instance with a custom launch configuration. You can configure multiple server connectors for the same server.

    1. Define a new server using the same runtime environment setting as the previously configured server of this type.
    2. Double-click the new server in the Servers view to open the server configuration.

      Viewing server configuration
    3. Click the Open launch configuration link.
    4. Customize the various launch details as needed, and click OK.

      Launch Configuration window

    Now, you have a server instance with a specific launch configuration to which you can deploy projects.


    Servers view with custom JBoss launch configuration