Forum Stats

  • 3,814,867 Users
  • 2,258,922 Discussions
  • 7,892,882 Comments

Discussions

Launch BTF in new window via URL - always creates a new AM instance?

KevinAngus
KevinAngus Member Posts: 104
edited Aug 8, 2013 3:21AM in JDeveloper and ADF

Hi,

JDeveloper/ADF 11.1.2.4

I am using the method documented by Frank Nimphius to open a bounded task flow in a new window. The difference in my case is that rather than an isolated data control scope, I would like the new window to share the same app module instance of the launching window.

My BTF has Transaction set to <No Controller Transaction> and the Data Control Scope set to shared.

When I run the first page (in the unbounded task flow) a new AM instance is created as expected.

When I click the button to launch the window with the bounded task flow, a further AM instance is created.

The problem is that in the original application module I have stored some state information in the session user data (and I have coded the passivate/activate process to handle this). Unfortunately the second AM instance does not have access to this data. The session user data is empty and no activation process fires to populate it.

I can use Andrejus Baranovskis's method to inject the session data into the new AM instance using a custom Data Control Factory, however it seems unnecessary to instantiate the second AM when the first could be reused.

Is there some way I can configure the system to share the app module between the two windows? If you launch a BTF via a URL will it always instantiate a new App Module regardless of the transaction settings?

Many thanks,

Kevin

Best Answer

Answers

  • KevinAngus
    KevinAngus Member Posts: 104

    That ominous feeling as you watch your question slip to page 5 without an answer...

    I've read every article and paper on BTF transactions I can find but none deal with launching directly using a URL.

    Anyone got any thoughts on this? If it's expected behaviour fair enough, if not then I'll log an SR.

    Cheers,

    Kevin

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,251 Red Diamond

    Kevin,

    I don't know an answer, but you can try to set the transaction to 'use existing' and see what happens.

    if you get an exception you know that in this case the am can't be shared. If you don't get an exception the BTF should use the callers AM as they now share the transaction.

    The behavior might also be influenced by the browser you use. Have you checked using different browsers?

    Timo

    Timo Hahn
  • KevinAngus
    KevinAngus Member Posts: 104

    Hi Timo,

    Thanks for your reply.

    I tried setting the BTF (called objects-btf) to Always Use Existing Transaction but the launched page errors:

    oracle.adf.controller.activity.ActivityLogicException: ADFC-00006: Existing transaction is required when calling task flow

    objects-btf is being launched from the unbounded TF so no controller transaction will have been started and this would be expected I guess.

    I changed my app slightly to explicitly begin a transaction before calling objects-btf. I moved the launching page (start.jspx) into a new bounded task flow called menu-btf that has Always Begin New Transaction set.

    UTF: login.jspx --> menu-btf

    BTF: menu-btf (start.jspx), begin new transaction

    BTF: objects-btf, use existing transaction

    Unfortunately this threw the same error.

    It seems that by launching via a URL there is no link in the controller between the launching and launched task flows.

    Perhaps there is some call I can make to the controller to make it aware?

    Good suggestion to check different browsers, I tried several but all had the same problems.

    Cheers,

    Kevin

  • KevinAngus
    KevinAngus Member Posts: 104
    Answer ✓

    Hi,

    I logged an SR for this and the answer is that this is by design. A new window will always cause a new AM instance to be created.

    Cheers,

    Kevin

  • User_HWHT9
    User_HWHT9 Member Posts: 2,858 Employee

    As for an "ominous feel" it's not that ominous let me assure you.  We're now working on clarifying the documentation in these edge use cases.  Doc bug 17279430 has been raised and we're actively working with the doc team on this one.  We intend to cover off the BTF by URL use case as you've stated here, and also accessing the app from another browser tab/window in general.  Broadly speaking the framework is actually quite clever in how it handles all this, but, agreeably if it's not documented that doesn't help you the customer - so we hope to fix this soon.

    As section "24.2 Sharing Data Controls Between Task Flows" in the 12c Fusion Dev Guide is relatively new, if there are any other suggestions you have on improving it we're all ears, nows the time to raise your concerns on how we describe the data control frame.

    CM.

    User_HWHT9
  • KevinAngus
    KevinAngus Member Posts: 104

    Hi Chris,

    Thanks for the update. I was hoping to hear from you on this one as your blogs on the subject have been very useful to me in the past.

    Focus on the already excellent documentation is always appreciated. I couldn't find anything on this case in the official documentation nor in any of the ADF books or blogs so its great you will be including it in the future.

    As for "ominous", sorry, it was meant as a backhanded compliment at the popularity of the board . Posts can disappear quickly off the first page if there's a flurry of activity and by page 5 I panicked and bumped it...

    Cheers,

    Kevin

  • User_HWHT9
    User_HWHT9 Member Posts: 2,858 Employee

    No worries.

    Like I said comments on how the documentation can be improved are always welcome, so please feel free to post on these forums, let me know and I'll take it up with the documentation team.

    CM.

This discussion has been closed.