Oracle’s WebLogic is a leading Java-based server software application that runs on a middle tier. Eclipse is an open-source community that develops open platforms and products. As they are both industry standard leading product, developers usually integrate the two toolkits together to develop the J2ee application, in order to significantly fix a server-side Java problem appeared trivia, we need to debug java code on weblogic server with eclipse via Java Debugger(jdb). In this how-to, we will guide you how to create a remote debugging connection between weblogic and eclipse.
What is the Java Debugger (jdb)? it is a dynamic, controlled, assignment-based debugging tool, a simple command-line tool for Java classes and was introduced in earlier JDK toolkit. It helps developers debugging issue, bugs fix and trouble shooting in java language platform.
1. Locate startWSL.cmd and add the following variable DEBUG_OPTS:
There have some options in above statement, the option
-Xdebug enables debugging support in the VM, the option
-Xrunjdwp:transport= dt_socket,address=8888,server=y,suspend=n loads in-process debugging libraries and specifies what kinds of connection to be made. Specifically,
address indicates the port where weblogic listens on.
2. Open weblogic start-up command line, add variable DEBUG_OPTS follow on the “%JAVA_HOME%\bin\java. double-click it to start weblogic server.
3. Start Eclipse, navigate to File->import->General->”Existing Projects into Workspace” to import all existing source to eclipse workspace.
4. Navigate to Run->Debug Configuration, Within the “Debug Configuration” dialog, select item “Remote Java Application” in the selectbox located on the left panel, click on icon “New lunch configuration”, input the name and click browse button to choose the project what you want remote debugging on right panel, then select “Standard(Socket Attach)” as connection type. type the host and port.
5. Click apply and add line breakpoints within source code editor, go to web browser, and type your web application(weblogic) URL, now you should be able to view that Eclipse debugger is started and remote debugging is working on port 8888.