Showing posts with label WEB_ADDITIONAL_OPT. Show all posts
Showing posts with label WEB_ADDITIONAL_OPT. Show all posts

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.

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

OUAF C2M 25.4 installation on Windows64

This blog is for anyone looking to installing Oracle C2M 25.4 on windows. Main changes observed in this installation compared to earlier ins...