Tuesday, 21 February 2017

Attaching Java Debugger in OUAF


This blog explains how to configure Java debugger for any OUAF product.

Set the parameter WEB_ADDITIONAL_OPT in ENVIRON.INI file to the following

WEB_ADDITIONAL_OPT=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=7757,server=y,suspend=n

The port number (7757) can be set to any port that is not being used.
The parameter can be set during initial configuration or you can go to ENVIRON.INI file and update the value of the parameter.

Run initialSetup.cmd so that the parameter is updated in all the configuration files.

Now start the server


As seen below the listener port is opened up waiting for Remote Java debugging requests


Open Eclipse
Go to Run -> Debug Configurations -> Remote Java Application

Enter the host with the ip of the server on which the above setting was made. In port enter the port number set earlier.

Open the java code you want to debug

Double click on the line in the java code you want to debug. This puts a breakpoint on the code as seen below.

Now, go back to Debug Configurations and click on Debug button.


As seen below, eclipse connects to the server and the debugger is connected.

Now open the application and go to the functionality for which the above java code is referred. In this case, the code is for a Web service. Hence opening XAI Submission and executing a request to hit the Java Web Service referred above.

The moment you execute the request, the control reaches the eclipse window. As seen below, the runtime stops at the code line where the debugger is attached. Also the different windows in the debug perspective help to see the various values of variables referred in the runtime.


As seen above, you can hover over different variables to see their runtime values.
Also you can use F5 to step in. F6 to step over.

When you want to end the debugging session, just click on disconnect button


So that’s how a java debugger is attached for an OUAF application. Try it out, let me know in case of any doubts. Happy Debugging.. ☺

2 comments:

  1. Can you let me know where you have put WEB_ADDITIONAL_OPT to the following

    WEB_ADDITIONAL_OPT=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=7757,server=y,suspend=n ?

    I mean in which file was this added?

    ReplyDelete
    Replies
    1. This blog is for older version of the framework. The steps are different for native installation of weblogic. If you need it for older version. The parameter is to be added in ENVIRON.INI file. Refer this blog for the steps for newer version: https://myouafworld.blogspot.com/2020/06/attaching-java-debugger-in-ouaf-for.html

      Delete

OUAF Oracle Utilities WAM / ODM 2.4.0.0 installation on Windows

  This blog is for anyone looking to install Oracle Utilities WAM or ODM 2.4.0.0 (Oracle Utilities Workflow and Asset Management) or (Orac...