Debugging WebLogic Server Applications Using Eclipse and the WebLogic-Plugin

by Jeremy Whitlock

02/28/2006

Abstract

When I first started working on BEA WebLogic Server applications, there wasn't much support for actively debugging applications deployed to WebLogic Server while developing in Eclipse—such functionality existed only in WebLogic Workshop 8.1. For this reason, I wrote the WebLogic-Plugin for Eclipse, an extension to the basic Eclipse IDE to provide WebLogic Server integration features.  After nearly two years since its inception, the plug-in has changed dramatically to provide many more features than simply debugging your deployed application. This article gives you a good overview of the WebLogic-Plugin and its features, and a handle on how to install and use the WebLogic-Plugin to deploy and debug applications.

Introduction

Unless you've been under a rock the last year you have probably heard of the Eclipse IDE. Eclipse has become one of the most popular IDEs, and the goal of the WebLogic-Plugin project on CodeShare was to create an extension to the Eclipse IDE for managing and debugging deployed applications on WebLogic Server. While the final version of the plug-in is not finished yet, here is the planned feature list for 2.0.0 final:

  • Configuration and management of local and remote WebLogic Servers and their deployments
  • Visual representation of your configured servers and their deployments
  • Real-time GUI representation of your WebLogic Server's state and deployments
  • Management of the full lifecycle of your deployments with easy ways to deploy, redeploy, and undeploy your WebLogic deployments
  • Easy context-driven menus for all user actions
  • Integrated help and documentation
  • Full localization support
  • Easy migration of configured servers from one system to another, thanks to the integrated export/import features

As you can see, we have ambitious plans to create an Eclipse plug-in that provides full lifecycle management of applications deployed to an out-of-the-box Eclipse IDE.

This article helps you install the WebLogic-Plugin and then utilize it to manage a WebLogic Server, manage its deployments, and debug a simple EJB deployed to the WebLogic Server.

Environment Setup

To get any use out of this article you will have to make sure that your environment is ready. Here are the tools that you need to have installed:

  • The Eclipse IDE (3.x)
  • WebLogic Server (8.x/9.x)
  • The WebLogic-Plugin (2.x)

The installation of Eclipse and WebLogic Server is outside the scope of this article, but the WebLogic-Plugin installation instructions can be found here. Just make sure you choose the 2.0 version when installing. Before we configure a server, let's make the WebLogic Servers view visible:

Window > Show View > Other... > WebLogic > WebLogic Servers

Now that everything is installed, we're ready to look at how to use the WebLogic-Plugin.

Configuring a Server

The concept behind the WebLogic-Plugin is simple. You create configurations that correspond to an existing WebLogic domain. Once your domain is ready, you need to let the WebLogic-Plugin know where this domain is, what the domain's resource requirements are, and finally how to properly start up the domain. To do this in the WebLogic-Plugin, you need to configure a server, and the WebLogic-Plugin provides you with the means to do it.

To use the WebLogic-Plugin you need to have a WebLogic domain already created. Based on the version of WebLogic Server that you will be running, the following documents will help get your respective WebLogic domain created:

In the WebLogic Servers view, click the Green Arrow to spawn a dialog allowing you to configure the WebLogic Server that you want to deploy this sample application to debug. Here is a description of all parts of the Add WebLogic Server Instance dialog:

General tab

The General tab is used to give information about your WebLogic Server installation and domain configuration. A lot of this information may seem unnecessary, but the WebLogic-Plugin uses this information extensively beyond starting/stopping the server. Values input on this form will override any of the same references in the config.xml (such as the port and SSL port):

  • Display Name: the name used in all GUI parts of the plug-in
  • Server Type: the version of the WebLogic Server (anything before 8.x allows only starting/stopping and debugging features)
  • BEA Home: the location where you install your BEA products
  • WebLogic Home: the location where WebLogic is installed
  • Domain Name: the name of the WebLogic domain you want to manage
  • Domain Home: the location where your WebLogic domain resides
  • Server Name: the name of the WebLogic Server
  • Hostname: the name of the host running WebLogic (only local management is available in the current version of the plug-in)
  • Port: the port WebLogic will listen on (will override whatever is in the config.xml)
  • SSL Port: the SSL port WebLogic will listen on (will override whatever is in the config.xml)
  • User Name: a WebLogic user capable of starting/stopping WebLogic
  • Password: the password for the above user

Classpath tab

The Classpath tab is useful for updating your configuration so that it either properly runs or properly debugs. The weblogic.jar and webservices.jar are already included. (This will be visualized before 2.0 final.) You can use the Classpath tab when your project requires JARs to be on the classpath or you need to prepend a .jar, like Xerces, to override the ones delivered with WebLogic. Another use of the Classpath tab is for debugging. When you debug your application, you need to have the Eclipse project you are debugging to be on the classpath. For the example, we do not need to modify this for now, but we will later when we want to debug.

Runtime tab

The Runtime tab is where we configure the runtime portions of your WebLogic Server configuration including VM and program arguments. We will get into this more when we begin debugging, but in the mean time, here is a description of the inputs:

  • JRE: the JRE/JDK used to run the configured WebLogic instance
  • VM Arguments: set your VM arguments here
  • Program Arguments: set your Program arguments here
  • JNI Library Path: set your JNI Library Path here
  • Run Mode: allows you to run WebLogic in Default mode or Debug mode

For this article, I have gone through the domain configuration wizard, mentioned above. In doing so, I changed only the domain's server name and the domain's name.

Figure 1 shows what the resulting configuration should look like.

Add Weblogic Server

Figure 1. The Add Server Dialog properly configured

Now that we have a server configured, let's start it up to make sure we don't have any problems. To start your configured WebLogic instance, right-click on the new server in your WebLogic Servers view. This will pop up a context menu. Click the Start menu item to start the server.

Figure 2 shows the result of starting your WebLogic Server successfully.

Figure 2. WebLogic Servers view updating after WebLogic Server started successfully

Assuming all is well, let's stop the server by right-clicking on your running WebLogic instance and clicking the Stop menu option and get on with debugging an application.

Note that we performed no configuration in the Classpath or Runtime tabs! You only need to do this when you are ready to debug the application. We will be doing this closer to the end of the article.