Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Friday, 7 August 2015

Data source drivers for ADF applications

Recently I found an error in an ADF 12c application in Production which was prompting error popups to users all the time. In the managed server log files, the following trace was registered:

oracle.jbo.SQLStmtException: JBO-29114 ADFContext is not setup to process messages for this exception.
[..]
Caused By: java.sql.SQLException: Statement cancelled, probably by transaction timing out

Firstly, I checked data source connectivity from WebLogic console, but the result was successful.



Then I found this post and this one, where the source of the problem was attributed to the data source driver. Despite the common practice of assigning JDBC XA drivers to data sources connections, this should not be used with Oracle Fusion applications, as it is documented here, because they are not compatible, "XA data sources close all cursors upon commit" and that produces errors. As that data source was using that type of thin XA driver (oracle.jdbc.xa.client.OracleXADataSource), I decided to change it.

As the list of driver types is only displayed when creating a new one, nd I did not know the exact name, I decide to create a new mock data source, just to get that value, which was:

Description: Oracle's Driver (Thin) for Instance connections; Versions:Any
Name: oracle.jdbc.OracleDriver



Once I knew the name, I edited the current data source with that driver name. However, I could not activate changes, because an error was received, it was related to not been able to update de data source configuration file.



The workaround consists in changing manually that configuration file. Navigate to the following folder in the domain server:

<adf_domain_dir>/config/jdbc 

Create a backup copy of the file with the data source name and edit the original one. Just update the parameter related to driver-name:

<driver-name>oracle.jdbc.OracleDriver</driver-name>

After this, the error disappeared from the production environment.


References


Don't Use Oracle's Driver (Thin XA) to Define WebLogic Data Source for ADF Applications
ADF: Resolving random JBO-27122 and closed statement errors
What You May Need to Know About JDBC Data Source for Oracle WebLogic Server

Thursday, 29 January 2015

ADF panelTabbed persistence issue with WebCenter Portal

Issue

 

Recently an issue was found working with ADF tabs. A panelTabbed component was added to a page with 'n' tabs, each of them had its own showDetailItem. The way this ADF component works is explained in this link; roughly speaking, there is a disclosed attribute in every tab where developer specifies when its content will be displayed. For instance:

       <af:panelTabbed childCreation="lazyUncached" id="pt2">
              <af:showDetailItem text="Tab1"
                                           id="sdi2"
                                           disclosureListener="#{pageFlowScope.utilBean.navigateToNode}"
                                           disclosed="#{navigationContext.currentNavigationModel.currentSelection.attributes['Target'] eq 'tab1' or param.p eq 'tab1'}"
                                           immediate="true">

                        <!--Task flow that will be displayed in that tab-->
                        <af:region value="#{bindings.taskflowTab1.regionModel}"
                             id="r3"/>

                        <!-- Navigation path to the tab, as it is defined in default-navigation-model.xml file-->
                        <f:attribute name="destination"
                                        value="app1/myTabPage/tab1"/>

               </af:showDetailItem> 
              <!--Other tabs here-->
         </af:panelTabbed>




Tabs are accessed via:
  •  URL: Introducing an URL specifying the tab parameter, i.e. http://localhost:7101app1/faces/oracle/webcenter/portalapp/pages/myTabPage.jspx?p=tab1
  • Click: Just clicking on the tab.
After deploying application to Development environment, the following issue was reported:


If a tab is clicked, then URL links to other tabs stop working properly. For instance, if tab number 4 is clicked, then URL links to tabs after number 4 stop working.

A Service Request was registered in Oracle Support and a tes case was provided. Pascal B., an experienced WebCenter Portal engineer, was able to reproduce the issue and found the cause:

It is an issue related to persistence storage. When a tab is clicked, the persistence for the selected tab is not set and the issue appears.


Solution

 

A workaround was provided which successfully solved the problem. By overriding the default ComposerChangeManager class to avoid persistence problems. Steps:

1. Create a java class to overwrite the default ComposerChangeManage: PortalComposerChangeManager.java

2. Set this custom ComposerChangeManager as default composer manager in the web.xml file:
Comment out the following
<!--
<context-param>
<param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
<param-value>oracle.adf.view.page.editor.change.ComposerChangeManager</param-value>
</context-param>
-->

Add the following:
<context-param>
<param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
<param-value>oracle.webcenter.portalapp.override.PortalComposerChangeManager</param-value>
</context-param>


3. Save all, deploy and test the application.

NOTE: As requested, here you may download a Tabs Sample Application where this issue is reproduced, and the same application where the issue is solved using the workaround.

References

 

PortalComposerChangeManager.java

ShowDetailItem Documentation

Oracle Service Request: SR 3-9372590301: ADF panelTabbed Navigation issue with WebCenter Portal

Bug 19265590 : ADF PANELTABBED NAVIGATION ISSUE WITH WEBCENTER PORTAL

Thursday, 22 January 2015

Rendering ADF based on the device type

According to some statistics, nowadays more than half of internet usage occurs on mobile platforms. So it is time to ask yourself if your Portal is working properly in tablets and phones.

Latest WebCenter Portal release (11.1.1.8) includes some useful features that control how the pages are displayed in different devices. Also, if you are interested in modifying some Portal behavior in your code, deviceManagement EL expressions are available.

The following piece of code will return the device type accessing Portal:

<af:outputText value="#{DeviceAgent.currentScopeDeviceGroup.name}" id="a1"/>

This group of expressions has several applications, for instance conditional rendering:

                    <af:commandLink rendered="#{DeviceAgent.currentScopeDeviceGroup.name eq 'desktopBrowsers' or DeviceAgent.currentScopeDeviceGroup.name eq 'iOSTablets'}"
                                    text="Register"
                                    id="gl1" styleClass="linkBlue">
                      <af:clientListener method="open" type="click"/>
                    </af:commandLink>


That piece of code will show a Registration link only if the user is accessing Portal via desktop computer or iPads.

Possible values: desktopBrowsers, iOSTablets, iOSPhones, androidTablets, ...

References

 

Tablet Growth: Usage Statistics and Expectations