How to debug java web application in eclipses with weblogic server

I have a Java application with Eclipse IDE and WebLogic 11g server. Can I remotely debug my application? if so, how?


source to share

2 answers

Add the following line to the script file used to start the Weblogic server eg. startWeblogic.cmd

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


The Weblogic server console should display the message:

Listening for transport dt_socket at address: 8453


In eclipse follow the instructions below:

  • Select Run> Debug Config ... from the desktop menu bar (or Debug Config ... from the drop-down menu on the Debug toolbar) to display the launch configuration dialog.
  • Select Remote Java Application from the configuration types list on the left.
  • Click the New toolbar button . New Remote Launch Configuration and three tabs are displayed: Connect, Source and Common.
  • In the Project field of the Connect tab, enter or select to select a project to use as a launch reference (for Look source). You do not need to specify a project.
  • In the Connection Type tab Connect , you can choose how you will connect to the virtual machine. Most of the time you will attach to the vm at a specific location, in which case select Standard (socket). the rest of these instructions assume you have chosen this option. The standard connection (Socket Listen) type creates a startup that will listen for incoming connections from the remote virtual machine. You will need to specify the port that will be started listen.
  • In the Host field on the Connection tab, enter the IP address or domain name of the host on which the Java program is running. If the program is running on the same computer as the work tool, enter localhost.
  • In the Port field on the Connect tab, enter the port where the remote VM receives onnections. Typically, this port is specified when starting the remote virtual machine.
  • The Allow remote VM to terminate flag is a toggle that determines whether the terminate command is enabled in the debugger. Select this option if you want to be able to shut down the virtual machine to which you are connecting.
  • Click Debug . Start tries to connect to the virtual machine at the specified address and port, and the result is displayed in the Debug view. If the launcher cannot connect to the virtual machine at the specified address, an error message appears.




First make sure you enable remote debugging when you run your script for Weblogic:

-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n


(address is port number, remember this number)

Second, you need to set up a new debug configuration for the remote web application in Eclipse:

Run -> Debug Configurations...


then create a new configuration for the remote web application. Make sure you include your host and port (see above) and add any web application source to the Source tab.

Now you can run this debug configuration to debug your web application in Eclipse on the specified Weblogic server.



All Articles