MyEclipse Logo
 

WebSphere 5.x, 6.0, 6.1, 7.x Tutorial

Table of Contents

download the latest MyEclipse version

help and support
 

1. Introduction

MyEclipse Blue Edition™ provides advanced WebSphere® project deployment management as well as application server control features. This document will outline how to configure MyEclipse to work with your WebSphere Application Server instance using these advanced features.


 

2. System Requirements

This tutorial was created with MyEclipse Blue Edition and WebSphere 6.1.

If you notice portions of this tutorial appear different from the screens you are seeing, please let us know and we will make sure to resolve any inconsistencies.


3. Setting up the WebSphere Connector

The first step for configuring the WebSphere connector is to go to the Windows > Preferences > MyEclipse > Servers > WebSphere connector group, and select the application server connector you wish to configure:

Once you have selected the specific connector you want to configure, Enable that server connector, then click the Browse button next to the WebSphere home directory field:

then navigate to the WebSphere home, or installation, directory and select it. Then click OK.

After clicking OK, MyEclipse Blue will automatically discover all the remaining properties for the application server and set them for you:

In addition to setting the base connector properties (above), MyEclipse Blue will also identify and configure the JDK that is part of your WebSphere installation:

Of course you are free to change any of these settings manually as you wish.

Click OK after you are done with the connector configuration and accept your changes, MyEclipse will perform the final configuration steps for the connector's operation:


4. Starting, Stopping & Restarting WebSphere

Once you have configured the WebSphere connector of choice, you can manage running, stopping or restarting your WebSphere instance from the toolbar or from the Servers view:

To start WebSphere from the toolbar, simply click the dropdown button next to the server icon, select the connector you want to use, and then click Start or Stop depending on it's running state:

To easily restart the last server started, simply click the server icon itself in the toolbar.

As the WebSphere server starts up, the Console view will display logging output from the server. You will know when the server has completed it's startup by the last line in the Console view reading:

Server <server name, usually 'server1'> open for e-business

After the server has started, you can check it's current running status from the Servers view as well as the mode it was started in (Debug or Run) and any deployments that are currently deployed to it. Think of the Servers view as a dashboard for viewing and managing the state of MyEclipse servers.

The Servers view also provides tools for restarting, stopping and managing deployments for the individual application servers listed; just like the toolbar:

To shut down the server, you simply select it in the list, then click the Stop icon. WebSphere will log it's shutdown messages to the Console view as it did during startup. You will know that the server has shut down completely when you see the line:

Server <server name, usually 'server1'> stop completed.


5. Deploying a Project

Deploying Web Projects or Enterprise Projects to your WebSphere application server from MyEclipse are very similar processes, straight forward and can be done in two different ways:

  1. Traditional - Using the deployment tool you specify the project you want to deploy, which server you want to deploy it to and the type of deployment; MyEclipse then deploys it.
  2. Automatic - Using the "Run As" or "Debug As" menus and selecting MyEclipse Server Application, MyEclipse will automatically package and deploy your project to the server of choice, then (re)start the server automatically. If the deployment already exists it is updated then the server (re)started automatically.

We will show you both methods of deploying a project, starting with Traditional first.

Even though the screenshots below show the process for a Web Project, deploying an Enterprise Project works in exactly the same way. When you deploy the Enterprise Project using either the Traditional or Automatic methods, the Enterprise Project is packaged up into an EAR, containing all it's modules and deployed.

5.1 Traditional Deployment

As an example of a Web Project, we will use the GoogleMapsExample from the Examples On-Demand service:

To create a deployment of this project to WebSphere, we can do this two different ways:

  1. Using the deployment tool button from the toolbar
  2. Using the deployment button from the Servers view

In this case let's use the deployment tool button from the toolbar:

NOTE: The application server can either be running or stopped when the deployment is created. Both will work.

When the deployments dialog opens, first you want to select the Project you wish to deploy, then click the Add button:

On the following screen you have to select the Server you wish to deploy the project to then hit Finish:

Optionally you can adjust if the deployment is Exploded (for development, where each change is synchronized with the server as the file is saved) or Packaged (for production, where a WAR or EAR is created and deployed only when the developer comes to this dialog and hits the Deploy button). Choosing either is technically fine, but using the default of Exploded will provide faster development cycles for you as your changes are pushed out to the server instantly (hot-sync'ed).

After clicking Finish, the deployment tool will deploy your project directly into WebSphere automatically, with no need to load the administrative console and finish it yourself:

After the project has been deployed to WebSphere, the deployment tool will provide a Successful indicator to you (or a warning/error message if necessary) letting you know the status of the deployment:

Additionally, WebSphere will log the deployment process to the Console view if you want to examine it for any reason. The important line of the log to notice is the last line stating:

Application started: <Your application name>

5.2 Automatic Deployment

Now, assuming you don't want to manage your project deployments yourself or your server running state, and just let MyEclipse Blue handle all of that for you, you can use Automatic deployment.

Automatic deployment works by using two new Run As or Debug As menu items that exist in the context menu for a project; it is called MyEclipse Server Application:

When you click that menu item, MyEclipse will then prompt you to select the application server you want to run your project on:

After selecting the server, MyEclipse will automatically deploy your application in Exploded mode to that application server, then (re)start that server for you.

If you open the deployment tool or focus the Servers view, you'll notice the application server you ran your project on now has a deployment registered with it and in the application server Console view (WebSphere in this case) you'll likely see log messages reflecting the application server status and the new deployment that was automatically sent to it:

An important thing to remeber is that projects deployed this way are exactly the same as any other project. To remove the deployment you can use the Servers view or the deployment tool directly as noted above with Traditional Deployments; these are no different to manage.


6. Running & Debugging a Project

Above we covered in Section 4 how to Run, Stop and Restart your WebSphere server. In this section we are going to cover how to point your web browser at your deployed project to run it and then how to debug a JSP (debugging classes, Servlets, Beans, etc. are all done in exactly the same manner).

After deploying your project (either Traditionally or Automatically) to WebSphere, you can open launch the application by using the "Open in Browser" action that is available from the context-menu on deployment web projects or web modules (if they are a part of an EAR) in the Servers View:

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>

But with Blue Edition you don't have to remember what port or hostname your Websphere server is running on, and by using the "Open in Browser" action the correct URL will be opened in the MyEclipse Web Browser automatically.

Now that you have successfully loaded up your project in the browser you are ready to start debugging it.

In this particular project, there is a simple scriplet in the index.jsp file that we can use to debug, it occurs on line 22 of the file. What we do to debug that file, and that scriplet, is to double-click in the gutter of the editor on the far left to set a breakpoint marker. You can also right-click and Toggle Breakpoints on that area if you prefer:


Once the breakpoint is set, all you have to do is switch back to the Web Browser View and click the refresh button to get the page to reload and have MyEclipse Blue hit the breakpoint and load the debugger automatically for you:

When the debugger is loaded we can step through our application, step into bean code, inspect our threads, inspect variables and any other debugging operation you would expect to find in a debugger.

While this example debugs a scriplet in a JSP page, debugging class files (servlets, beans, POJOs, etc.) works in exactly the same manner. You simply set your breakpoint of where you want the debugger to stop then excercise your application in such a manner that the breakpoint will get hit.

TIP: If you are unable to get the debugger to load when you set breakpoints, check the Servers view and make sure you started the server in Debug mode and not Run mode. That is a common mistake.


7. Undeploying a Project

Undeploying a project that has been either deployed in a Traditional manner or Automatically is quick, easy and can be done from either the deployment tool (toolbar) or from the Servers view.

Removing a deployment (undeploying) from the Servers view requires that you first select the deployment you want to remove, then click the "X" icon to remove the deployment:

To remove a deployment using the deployment tool, you open the deployment tool from the toolbar, select the deployment you want to remove, and click the Remove button:

Using either of these methods will result in MyEclipse Blue presenting you with the undeployment dialog as it automatically shuts down and uninstalls the project from your WebSphere instance. Then as a last step MyEclipse deletes the deployment from the server all together:

WebSphere will log these activities to the Console view and any problems that you need to investigate:


8. Resources

In this section we want to provide you with additional links to resources that supplement the topics covered in this tutorial. While this is not an exhaustive list, we do make an effort to point to the more popular links that should provide you with diverse, high-quality information.



9. Feedback

We would like to hear from you! If you liked this tutorial, have suggestions or even some corrections for us please let us know. We track all user feedback about our learning material in our Documentation Forum.  Please be sure to let us know which piece of MyEclipse material you are commenting on so we can quickly pinpoint any issues that arise.