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
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.
- Click on the Servers view toolbar. Alternatively, right-click the Servers view, and select New>Server.
- 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.
- Accept localhost as the host name or you can provide the fully qualified DNS name or IP address of the host machine.
- Accept the default server name or enter a new name. The server name identifies the server in the Servers view.
- 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.
- Enter the runtime environment information, including the path to the server installation.
- 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.
- Click Next, and accept the defaults based on your selected server installation.
- Click Next to select projects to configure on the server.
- Click Finish. The server is configured and appears 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.
- Click Installed JREs on the runtime environment configuration page.
- 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.
- Select the JRE type you want to add to the workspace, and click Next.
- In the JRE home field, browse for and select the root folder of your JDK installation folder, not the JRE folder it contains.
- Enter a name in the JRE name field, and click Finish.
- Select the newly configured JDK from the Configured JREs drop-down, and continue with the server configuration.
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.
- Click on the Servers view toolbar. Alternatively, right-click the Servers view, and select New>Server.
- Click the Download additional server adapters link. This requires an active connection to the internet.
- Select WebSphere Application Server v8.5 Liberty Profile Tools, and click Next.
- Accept the license agreement, and click Finish. The server support will be downloaded and installed, and you are prompted to restart when complete.
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.
- Right-click the server you want to deploy to, and select Add/Remove Deployments.
- 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.
- Click Finish.
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.
- To enable Automatic deployment, right-click your project, and select either Run As> or Debug As>MyEclipse Server Application.
- 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.
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.
If the deployment mode is Exploded Archive, you can discover the deploy location by hovering over the deployed application in the Servers view.
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 .
Using the menu, right-click the project, and select Add/Remove Deployment. Select the project you want to remove, click Remove, and click Finish.
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.
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.
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.
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.
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.
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.
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.
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.
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.
- Define a new server using the same runtime environment setting as the previously configured server of this type.
- Double-click the new server in the Servers view to open the server configuration.
- Click the Open launch configuration link.
- Customize the various launch details as needed, and click OK.
Now, you have a server instance with a specific launch configuration to which you can deploy projects.