Tag Real-Time Decisions

Debugging an Oracle Real-Time Decisions Project in Eclipse

When developing and debugging a new Inline Service (ILS) for Oracle RTD, programmers sometimes require more than just standard console logging functionality. Because an ILS is actually code running on the server, debugging an ILS requires the use of Java remote debugging technology. In this blog post, we will walk through the procedure for debugging an Inline Service in Eclipse, for Oracle Real-Time Decisions.
There are three major steps involved in debugging an ILS from within Eclipse:

  1. Enabling remote debugging on the server.
  2. Creating the remote debugging configuration in Eclipse.
  3. Setting up breakpoints and debugging using Eclipse Visual Debugger

Enabling remote debugging on the server

Enabling remote debugging on the server side is done using Java -X options. Because these are not standard options, you may need to verify how it will work for your application server/JVM platform.

On oc4j under Windows, simply edit C:\OracleBI\RTD\oc4j\bin\oc4j.cmd by adding the following line at an appropriate location:

set JVMARGS=%OC4J_JVM_ARGS% -server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000

This will configure the application server to listen on port 4000 for the remote debugging session.

To enable remote debugging on port 4000 for Weblogic 11gR1 (that comes with Oracle Fusion 11.1.1.3.0) on Windows, you would use the following:

SET JAVA_OPTIONS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000

When starting the server, you should see something like the following image to confirm that the server is correctly set up to listen on remote debugging session on port 4000:

Creating the remote debugging configuration in Eclipse

Now that the server is ready, you can create the remote debugging configuration in Eclipse. We will use the CrossSell sample that comes with Oracle Real-Time Decisions as the base example.

1. Deploy the latest version of your ILS in Development mode.

2. Switch to the Java perspective in Eclipse.

3. Create the debugging configuration by clicking the Debug button  on the menu bar.

4. Select Remote Java Application and click New.

5. Name the configuration and select the appropriate project. Set the port to 4000 and click Apply.

6. You are now ready to debug the ILS. Start the debugging session by clicking the Debug button in the previous modal window, or by selecting your configuration from the Debug drop-down menu.

7. When it has finished, you must end the debugging session. To do so, click the Disconnect button from the Debug view.

Setting up breakpoints and debugging using Eclipse Visual Debugger

The Eclipse ILS will generate code for all of the ILS objects (such as choices, decisions, or integration points). The generated code will include the various code snippets added in the properties of these ILS objects, for instance, in the Pre/Post selection logic panel of a decision object. Because of the generated code, setting a breakpoint is not trivial as it is to set a (normal) breakpoint in regular code but is not difficult to do, as the generated sources all follow a simple naming convention and are all generated in the same location. The following procedure details how to set up a breakpoint in the CrossSell ILS’s Decision named ‘OfferDecision’. This decision is used by an advisor named ‘OfferRequest’. So setting a breakpoint in this decision will make the program stop every time we call the ‘OfferRequest’ advisor.

The Decision Pre/Post Logic panel:

Setting up a breakpoint in your ILS and tracing your code using the Eclipse debugger:

1. Go to the Java perspective.

2. In the Package Explorer, navigate to gensrc/com.sigmadynamics.sdo/GENOfferDecision.java

3. Locate the execute(int) method. Inside this function you will find the code that was declared in the Pre and Post Selection Logic section. There are comments the clearly defines them (// SDCUSTOMCODESTART.GetBestCreative.PostSelectionBody.java.0 for post logic for instance). Set a breakpoint on the line where the decision post-selection logic begins.

4. We can now call the advisor using the test view of the ILS. Eclipse will switch to the Debug perspective at the breakpoint that you just set.

5. You may receive a ‘Source not found’ message. If this is the case follow step 5.1 to 5.5. Otherwise, continue to Step 6.

5.1 Click on the Edit Source Lookup Path button. The following modal window will open:

5.2 Click  Add, then select Workspace Folder.

5.3 In the next modal window, select the gensrc folder inside the CrossSell Project and click OK.

5.4 Click OK again when you are returned to the initial modal window:

6. We can now step in and step out through the Decision’s code, as well as browse through the variable values, or expand arrays as you can in any GUI debugger.

Contact Objectifi for more information! www.objectifi.com

Copyright © Objectifi Inc.