remote debug in eclipse with both Admin and Managed Servers running

For configuring Remote Debug in Managed Weblogic Server,the very first golden rule is,you should not specify any port number of  weblogic admin or  managed server which is running ,it has to be a free port(use this link to find the appropriate ports List of Ports).

How to create managed weblogic server and run multiple EAR's can be found in this link -> Run Multiple Ear in Managed Server Mode

How to run remote debug in Admin server can be found in the link
->Remote Debugging Weblogic Admin Server


The configuration  for remote debug is specified in the startup script 'setDomainEnv.cmd'.



First Approach

Here we need to  create three scripts corresponding to the orignial scritps,'startManagedWeblogic.cmd', 'startWeblogic.cmd' and 'setDomainEnv.cmd.


For Eg:

Create the scripts  startManagedATGProductionWeblogic.cmd,startWeblogicATGProduction.cmd,
setDomainEnvATGProduction.cmd by copying from the original script.Modify the call to each of this scripts as per the new naming convention.

Then for the degbug to work  in the setDomainEnvATGProduction.cmd file

1. Set the debgug flag as true in the first line of the script.(set
   debugFlag=true)

2. Add the line to append JAVA_OPTIONS variable,if the debug options is not already there.Now all recent weblogic versions comes with the debug option.

set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=n %JAVA_OPTIONS%

In the address property you need to specify the debug port which i used as 8002 here.

Save the file and restart your managed weblogic server.
At the startup of managed weblogic server you can see this message
'Listening for transport dt_socket at address: 8002' you are done !!! . For Your Admin Server specify a port  eg:8004 in
setDomainEnv.cmd.Hope you know how to configure remote debug in eclipse.

Second Approach (Updated as per the new CIM settings)

Run CIM which will create instances for ATG Production,ATGPublishing and other Servers based on your Product Selection,you need a simple modification in the auto generated script generated by CIM for your Managed Servers. Copied the scripts generated by ATG10.2 CIM configurations below for your reference.The Bold part is the modification you need to do for remote debug to work.

C:\ATG\ATG10.2\home\servers\ATGProduction\startServerOnWeblogic.bat

setlocal
title ATGProduction

REM  -- Update USER_MEM_ARGS - added by CIM

set debugFlag=true

if "%DEBUG_PORT%"=="" (
    set DEBUG_PORT=8446
)


if "%JAVA_USE_64BIT%"=="true" (
  set USER_MEM_ARGS=-Xms512m -Xmx1024m -XX:NewSize=128m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=512m
) else (
  set USER_MEM_ARGS=-Xms512m -Xmx1024m -XX:NewSize=128m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=512m
)

REM  -- End USER_MEM_ARGS block - added by CIM
call "C:/Oracle/Middleware/user_projects/domains/base_domain//bin/startManagedWebLogic.cmd" ATGProduction t3://localhost:7001/ %*

endlocal


The script setDomainEnv.cmd will check whether the DEBUG_PORT is set,we are overriding this in the above script from our Managed Server and setting it to 8446.Similiarly if we call Admin Server Startup script it will default to port 8686.

setDomainEnv.cmd

if "%DEBUG_PORT%"=="" (
    set DEBUG_PORT=8686
)


This apporach will help to simultaneously run Admin and Managed Server with different EARS with Debugging enabled,This will be useful for Eg: We have a ATGProduction and ATGFullfillment Applications running in Admin and Managed or in multiple Managed Servers,We can run a live debug between applications,so that First Application create an Order and Second Applications start Processing the Order.

2 comments:

Vivek said...

The instructions are precise and of great help...Many Thanks...

Sebastian said...

thanks for your feedback

Post a Comment

Related Posts Plugin for WordPress, Blogger...