Thursday 25 June 2020

Attaching Java Debugger in OUAF for Native Weblogic Installation

Had covered the steps to attach a Java debugger for OUAF products using Weblogic embedded installation mode. Now the product has been updated, and the recent version of the OUAF framework, only supports native installation of Weblogic. Have updated the steps to be used for attaching debugger accordingly.

Follow below steps for attaching java debugger when you are using native installation of Weblogic with OUAF 

Navigate to your managed server for your OUAF product
Server -> Your managed server -> Configuration -> Server Start

Add the following line in Arguments section 
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=7757,server=y,suspend=n 
The highlighted number is the port on which you want to debug. Set it to a unused port. This is the port that you would be pointing to in Eclipse. 

Next click on Save button and save the changes 

Alternatively you can also use setUserOverrides.cmd that is present in %SPLEBASE%\tools\examples\bin folder
Copy this file to your Weblogic Domain Home Location
%Weblogic Domain%\bin

 
As seen above you can use this file which gets called when your managed weblogic server is started.
Once changes have been done on weblogic server, restart the server.
Verify that the ‘Listening for transport dt_socket at address: 7757’ is visible in your weblogic managed server logs when server starts up. This identifies that the server is started in debug mode.

Assuming you have already installed Oracle Utilities SDK and pointed it to your OUAF application. Go to your SDK eclipse installation. 

Go to Run -> Debug Configurations


Select Remote Java Application

Click on it and select New. 

Give some name to it. Have named it ‘MyDebugger’ 

Click on Apply button
Click on Debug button
Next Navigate to Window -> Open Perspective -> Debug

You can see that the debugger has got attached to your server instance. If debugger is not getting attached, restart the eclipse application and try the steps for creating Debug configuration for ‘Remote Java application’ on eclipse again. 

Next try adding a breakpoint to your custom code. You can also use any out of box code for this, provided you have decompiled the jar to java source code and attached it to the jar file in eclipse as jar source. 

Adding breakpoint
Double click on the line you want to add breakpoint. Or right click and add toggle breakpoint

Next run the application such that your code is called.
In above example code, I added a field activity from C2M front end using a BPA script. Once field activity is added the breakpoint is hit. 

Your browser application screen will hang, and you will see your eclipse application getting highlighted

Navigate to eclipse application

You should see the green control in eclipse at your attached breakpoint for debugging.



Use the above controls for debugging control.
  • Step Into – F5
  • Step Over – F6
  • Step Return – F7
  • Resume – F8
Remember that your application window will remain hanged till you resume the debug control.

This kind of debugging is useful when you want to check your custom code or out of box code of the product for actual flow at runtime. This helps you verify the values populated in the Java objects at runtime.

You don't have to wait for managed server to completely start to start debugging. If you want to verify classes that are called during server initialization, that can also be done using this. The control will come to eclipse as long a debug point has been added on the class that is being loaded by the framework. This helps, if you want to see how the OUAF framework loads initial objects and caches when server is started.

No comments:

Post a Comment

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...