JDev 12c: Debug Application Module Tester (BC4JTester) Problems

When you develop ADF Web Application you often use the ADF ApplicationModule Tester (BC4J Tester) to quickly test your business components data model and your self-written code in any EntityObject, ViewObject or ApplicationModule. For more information about how to do this look at JDeveloper & ADF: Use the Application Module Tester (BC4J Tester) to Test all your BusinessLogic.

Users who use one of the latest JDeveloper versions 12.2.1.1.0 and newer may have noticed, that the BC4J Tester application starts without an error, but doesn’t show the dialog. I run into this a couple of times lately and decided to dig into this problem. On the Oracle Development Spaces, I saw some threads about this too.

The reason for this behavior is that any EO, VO or other methods in the application module have an error, which can’t be found during compile time.

Use case

To show the effect, we start with a simple Workspace and a model project which only has one ViewObject in the Application Module’s data model

We implement a small use case where we want to see the total salary of all rows retrieved by the query behind the VO. Without any added where clause we get the total salary of all employees. If we add a filter e.g. by DepartmentId=90 we only get the total salary of all employees of department 90. Here are some images of the final running model in the BC4J Tester

Implementation

OK, so how do implement this use case?

We do this by adding a transient attribute to the EmployeesView and use a SQL default expression to do the calculation

sum(Employee.SALARY) OVER (PARTITION BY NULL ORDER BY NULL)

In the image below we see the definition of the transient attribute in the ViewObject

Problem

This should do the trick. However, when we try to test this in the BC4J Tester we get

In the log window, but no dialog where we see the application module. We don’t get any hint about what went wrong. The tester is up and running, but we don’t see anything.

Shay Shmeltzer mentioned in one of the ODC threads, that the reason for this is that there is an error in the application module (ViewObject, EntityObject or AM method). As the only thing we added is the SQL statement for the transient attribute, it’s clear that the statement must have an error. It’s simply a missing ‘s’ character, as the DB table we use is named ‘Employees’ and not ‘Employee’. So the correct statement is

sum(Employees.SALARY) OVER (PARTITION BY NULL ORDER BY NULL)

This will solve this problem and the BC4J Tester will start up and show (see the images above). But what if we added more things to multiple objects?

How to find the error then?

Older versions of JDev, the BC4J Tester did show an error message which showed the error and made solving the problem easy. Here is an image of the same application running using JDev 12.1.3.0.0

Solution

I did not manage to get the same output using JDev 12.2.1.1.0 or newer, but you can get the same message in the message window.

For this, you need to start the BC4J Tester with the java option

-Djbo.debugoutput=console

The option is added in the model projects ‘Run/Debug’ option in the project’s properties

Whenever you start the BC4J Tester and don’t get any dialog, you can assume that there is an error in the application module. To find out what the problem is, add the java option to the model project and you get the detailed information in the log window.

8 thoughts on “JDev 12c: Debug Application Module Tester (BC4JTester) Problems

  1. [quote]Shay Shmeltzer mentioned in one of the ODC threads, that the reason for this is that there is an error in the application module (ViewObject, EntityObject or AM method).
    [quote]
    Shay is not entirely correct: BC Tester will also fail with valid ADF code if:
    a) One of your view objects has a bind variable marked as required
    b) The application module contains a programatic VO.
    I located the error in the class:
    jbotester.binding.BaseTesterBinding
    It looks like there are two bugs:
    a) all AM’s view objects are unecesarily executed at BC Tester startup.
    b) if any of the VO throws an error during step a), the root exception is not further logged.

  2. Timo,
    We have two tickets with Oracle on this matter since March 2017:

    Bug 25736100 : APPLICATION MODULE TESTER DOES NOT START IF A VIEW OBJECT HAS AN ERROR

    Bug 23618068 : MODEL TESTER: ALL VIEW OBJECT INSTANCES ARE EXECUTED ON START-UP IN 12.2.1

    • Thanks, Florin. I’ll open an SR for this too. Makes it easier if there are already bugs for this. Let’s hope Oracle will fix the problems ASAP.

  3. Pingback: Developer Partner Community Newsletter December 2017 | WebLogic Community

  4. This is really annoying and Oracle has not yet delivered a patch. I had the same issue and spent some time to figure it out. The bc tester never shows up, no errors even with -Djbo.debugoutput=console.
    What I finally did is to enable jdbc tracing, which shows some errors on my view. So jdbc tracing could help in some cases.

  5. Pingback: JDev 12c: Debug Application Module Tester (BC4JTester) Problems by Timo Hahn | Developer Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.