EGL Development User Group - Group home

How to use EGL debug with the Liberty profile

  

 

Rational Business Developer V9.5 has added the capability to debug a web application using the Liberty 

Profile.  However, the capability to “automatically” configure the debug Liberty Server is not possible. 
 

Instead you will need to do some manual configuration to enable the ability to debug EGL Services under a Liberty profile.  

 

Note: Our goal in the future is for RBD to do the configuration automatically for the developer as we do 

for WebSphere Application Server today. 

 

First of all, you should know how to debug Service by using J2ee web container.  We have a blog about this entitled

which can provide more information on this capability.   Please see:

Improve performance of service invocations from RUI preview and debug mode by using J2ee web container.     This blog describes how to configure a debug listener in the application server so that debug can get 

control when invoking a service. 

 

Here are the steps to do the manual setup so that EGL debug can be done under Liberty

 

  1. Make sure you have installed WAS Liberty onto your machine.   This can be done by downloading the IBM Rational Application Developer for WebSphere Software V9.5 Multi-platform Multilingual - WAS Liberty for Developers V8.5.5.7 for Rational V9.5 within the RBD install images on Passport Advantage.
     
  2. The previous blog above uses a Tomcat server as an example, but this time you must define a server in the servers view whose type is the Liberty Profile

 

 

 

 

 

  1. Create a Web Project to enable the listener for EGL debug as the above blog said. 

(including all the steps in the above blog step2 Create a Web Project to hold the listener for EGL debug.)

 

 

  1. Within RBD, you need to start the Liberty server in debug mode.   This does not actually start the EGL debugger, but is needed so you can deploy the EGL debug listener project to the server.   
  1. Right click the web project created in above steps, select debug as -> Debug on server to deploy it to the liberty profile.  you can see the server is started in debug mode

 

 

After the server is started, you should stop the debug Liberty server.

 

  1. Add the IBMDebug.jar as a shared library to Liberty

 

The IBMDebug.jar can be found in the bin directory of RBD installation Directory

You should copy the IBMDebug.jar to liberty server directory in your file system (based on your server name) e.g  D:\Liberty8556\usr\servers\myNewServer

Or you can copy the IBMDebug.jar to liberty shared resource directory and it can be shared by all servers

e.g D:\Liberty8556\usr\shared\resources

 

Here is an example of where to obtain IBMDebug.jar in RBD 9.5's folders

 

 

Here is an example path of Liberty shared resources after copying in the IBMDebug.jar
 

 

 

 

Next, the IBMDebug.jar needs to be added to Liberty's server.xml as a shared library:

The server.xml can be edited by just double clicking the server configuration in the servers view

 

 

If you copied the IBMDebug.jar to liberty servers directory, you should add the following to the Liberty's server.xml as a shared library    

e.g

<library id="IBMDebug" name="IBMDebug">
              <file name="IBMDebug.jar"/>
         </library>
 

 

 

If you copied IBMDebug.jar to Liberty’s shared resources directory, you can do the following:
 

 

 

Add a share Library element

 
 

Input the ID and Name
 

 
 

Add a file for the shared library
 

-
 

Add the file name by clicking Browse and locating the IBMDebug.jar file
 

 

 

 

 

After modification , please save the server.xml
 

  1. For each EAR, deploy the ProjectName.ear (based on the project name) to Liberty and add the IBMDebug reference name as a shared library classloader to the enterpriseApplication definition in Liberty's server.xml

    In Liberty's server.xml, the shared library must be added as a classloader location to the EAR's enterpriseApplication definition.

e.g

<enterpriseApplication id="ProgramNameEAR" 

location="ProgramNameEAR.ear" name="ProgramNameEAR">
        <classloader commonLibraryRef="IBMDebug"></classloader>
        </enterpriseApplication>

       then save the server.xml.

 



To prevent RBD from automatically attaching the JDT debugger (which you don’t want), start Liberty in debug mode from the command line using "server debug".  

This will start Liberty and make it wait for a debugger to attach (on default port 7777).

 

  1. Use CMD to open a command window and find the liberty/bin directory( e.g  D:\Liberty8556\bin) and type

“server debug serverName”  (no quotes)
 

  1. If you don’t specify a serverName for liberty, just start with:

“Server debug”     (no quotes)
 

  1. After the server debug starts ,you can see the cmd line showing in the CMD Window,

e.g 

D:\liberty8556\bin>server debug myserver

Listening for transport dt_socket at address: 7777

 

 

 

 

  1. Then do not close the CMD window and keep the window showing.  Closing it will shut down the Liberty Profile.
     

 

Within RBD, create a new WebSphere Application Server debug launch configuration, and use it to attach to the waiting Liberty (default port 7777)

Use WebSphere Application Server v8.5 as the Server Type.

 

You can create the  the debug launch configuration by:  Run->Debug Configurations...-> double click WebSphere ApplicatioServer .
 

Then fill in the Name, select the project you want to debug, select IBM WebSphere Server V8.5 as the IBM WebSphere Server type, and then click Debug (see the screen shots below)
 

 
 

Double click the WebSphere Application Server (not Liberty Profile Server.)
 

 

 

Input the name and select the web project, the server type should be WebSphere Application v8.5
 

 

 

Then you can see the attach info showing in the Cmd window which already opened.  If you dont see anything change in the command window, please confirm the port and check the above steps.
 

 

 

 

After those stepswhen a service is invoked, it will invoke the EGL debugger for that service under liberty.

 

Note that the configuration of the Liberty server is only needed once.  Each EAR will need to be added and of course, the Liberty server has to be started when needed.