Updated: 5/27/03; 2:09:36 PM.
BC4J Helper by Sung Im
Thoughts on how BC4J works, code samples, and other helpful techniques
        

Thursday, May 01, 2003

When you debug your application, you may find a need to set a breakpoint on a method that you do not have source to.

In that case, you can use a method breakpoint to break the debugger when such a method is called.

Here is how:

  1. In the IDE, select the project.
  2. Select View/Debug Windows/Breakpoints menu. You will see the BP window at the bottom.
  3. On the BP window, right mouse click, and select 'New Breakpoint...' In the Breakpoint Type combo-box, select 'Method'.
  4. In the 'Method' text box, enter full method name, e.g., oracle.jbo.server.DBTransactionImpl.addTransactionPostListener
  5. Press OK.
  6. Debug your application.

When addTransactionPostListener is called, the debugger will break.


1:54:55 PM    comment []



When you debug your application, you may want to break when a particular exception is thrown.  Here is how you do that in JDeveloper.

Let's suppose you want to break when an oracle.jbo.DMLException is thrown.

  1. In the IDE, select your project.
  2. Select View/Debug Windows/Breakpoints.  This will bring up the breakpoint window.
  3. On the BP window, right mouse click and select "New Breakpoint..."
  4. On the BP dialog, choose "Exception" for "Breakpoint Type."
  5. Enter "oracle.jbo.DMLException" for "Exception class."
  6. Debug the app.

At the time when DMLException is thrown, the debugger will break.  You can take a look at the stack trace to see what caused the exception to be thrown.


1:20:19 PM    comment []


When you encounter problems running a BC4J application, one of the first things you can try is to turn on diagnostic to see if the diagnostic output offer further information on the problem.

This is especially true with exceptions.  When you receive a BC4J exception, the BC4J exception may carry a detail exception.  The detail exception will give you further info on what went wrong.  For example, your application may receiven an oracle.jbo.DMLException when you try to post an entity row.  This DMLException may have been caused by a SQLException at the JDBC layer.

In this case, the DMLException carries the SQLException as its detail exception.  If you have the diagnostic turned on, it will show the BC4J exception stack as well as the detail exception stack.

To turn on diagnostic, you need to specify

   -Djbo.debugoutput=console

as one of the JVM switches.

If you're invoking your app (middle-tier app) from command line, include -Djbo.debugoutput=console as in

   java.exe -Djbo.debugoutput=console ...

If you're running your app from within JDev:

  1. Select the project.
  2. Do right mouse click and select "Project Settings..."
  3. On the Settings dialog, select Configurations/Runner.
  4. In the righthand side pane, you should see a textbox for "Java Options".  Add the following JVM switch: -Djbo.debugoutput=console

Then, rerun.  The run command should include -Djbo.debugoutput=console as in

"D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...

You should now see a lot more output on the IDE's message window.


1:11:56 PM    comment []


This weblog site will be used to publish ideas, sample codes, and explanations of various features of Oracle's J2EE framework Business Components for Java ("BC4J").

For an introduction of BC4J, refer to Steve Muench's document:

Simplifying J2EE and EJB Development with BC4J


1:02:43 PM    comment []


© Copyright 2003 Sung Im.
 
May 2003
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Apr   Jun


Click here to visit the Radio UserLand website.

Subscribe to "BC4J Helper by Sung Im" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.