Wednesday, April 18, 2012

JDeveloper 11g R2 Bug - Wrong Scope for Managed Bean

During recent training event, I have noticed students were struggling with JDeveloper 11g R2 issue - sometimes Action method from the button was throwing exception about invalid Action method name. This happens because there is a bug in JDeveloper 11g R2 IDE, it sets wrong scope for Managed Bean expression call, when Managed Bean is defined in Backing or PageFlow scopes. I decided to document this and describe the reason for Managed Bean error in JDev 11g R2, because is not so obvious for new ADF developers how to identify and resolve this issue. This bug is registered in our Ora-Bug Tracker.

Download fixed sample application - JDev11R2ScopeApp.zip.

This application contains one Managed Bean, this bean is declared in Backing Bean Scope:


Bean is pretty simple, it contains basic Action method:


We want to set this Action method to be called from the button, edit button Action property and set it to point to the method from the bean:


JDeveloper 11g R2, ignores Backing Bean Scope and sets bean reference as simple one - without referencing Backing Bean Scope - this will cause runtime error:


Runtime error - method is not found from the bean:


Workaround is to type backingBeanScope prefix manually:


This bug is reproduced only, when we are editing Action property and assigning existing method from the Managed Bean - not when we create new method by generating Action binding (right click on the button and choose Create Method Binding).

5 comments:

Anonymous said...

Hi Andre,

Thanks for your post. Recently I faced a strange issue. My application was working fine, but it suddenly stopped working in a sense that clicking a button does not produce any action,i.e backing beans method is not called, just nothing happens. any idea what is the reason for this?????

Andrejus Baranovskis said...

Hi,

May be your application decided to take a day off? :-)

Andrejus

Anonymous said...

Had this happen on ActionListeners too. Either creating a new one or editing an existing one. Looks like it's fixed in the new 11.1.2.2

Andrejus Baranovskis said...

I also noticed - seems like it is fixed in 11.1.2.2

Thanks for update.

Andrejus

fakhri said...

Hi Andre,
thanks for this post,
i insert an image in a blob using unbounded task flow but when i used bounded task flow i did not success and an error message appear when i pressed the button setImage(): java.lang.NullPointerException.

is there any other config to do before using bounded task flow ?
thanks