Wednesday, April 30, 2014

Which WebLogic optimization allows one non-XA resource

I was asked about the solution of the following task:

Which WebLogic optimization allows one non-XA resource to participate in a distributed transaction? Select correct answer:
  1. enabling Pinned to Thread 
  2. enabling Logging Last Resource 
  3. increasing the Statement cache size 
  4. setting the statement cache type to LRU 
  5. setting the initial and maximum capacity to the same number 
At start I rejected as absolutely erroneous answers 3 and 5.

Answers 1 and 4 also looked like wrong, but I checked it out:
  • LRU = When you select LRU (Least Recently Used, the default) as the Statement Cache Type, WebLogic Server caches prepared and callable statements used on the connection until the statement cache size is reached.
  • Pinned to Thread = About this documentation says: When Pinned To Thread is enabled, WebLogic Server pins a database connection from the data source to an execution thread the first time an application uses the thread to reserve a connection. When the application finishes using the connection and calls connection.close(), which otherwise returns the connection to the data
    source, WebLogic Server keeps the connection with the execute thread and does not return it to the data source. When an application subsequently requests a connection using the same execute thread, WebLogic Server provides the connection already reserved by the thread.
OK. Correct answer is 2. But WTF is  "Logging Last Resource". At first sight, there is no relation between LLR and transactionability. And .. nothing could be more wrong

Generally, if you have to use global transactions in your applications, you should use an XA JDBC driver. If an XA driver is unavailable for your database, or you prefer not to use an XA driver, you should enable support for global transactions in the data source. And what more (as says Administering JDBC Data Sources for Oracle WebLogic Server12c (12.1.2)), when you select Supports Global Transactions, you must also select the protocol for WebLogic Server to use for the transaction branch when processing a global transaction. One of this is:
  • Logging Last Resource: With this option, the transaction branch in which the connection is used is processed as the last resource in the transaction and is processed as a local transaction. Commit records for two-phase commit (2PC) transactions are inserted in a table on the resource itself, and the result determines the success or failure of the prepare phase of the global transaction. This option offers some performance benefits and greater data safety than Emulate Two-Phase Commit, but it has some limitations.

Sunday, April 27, 2014

Weblogic AGL Transaction Affinity vs. Web Session Affinity

In the world of JEE Application servers the term of "sesssion affinity" denotes that within a cluster of servers, requests from the same client always get routed back to the same server.

Web Session Affinity in Active Grid Link provides analogous functionality, eg. the session affinity policy is used to ensure that all the data base operations for a web session, including transactions, are directed to the same Oracle RAC instance of a RAC cluster. This mechanism is especially usefull because in some circumstances web applications (like shopping applications) have better performance when repeated operations against the same set of records are processed by the same RAC instance.
Applications typically use this type of affinity when:
  • short-lived affinity to an Oracle RAC instance is expected or
  • if the cost (in terms of performance) of being redirected to a new Oracle RAC instance is minimal.
Web Session Affinity should be used for short lived sessions that do not incur a significant penalty when redirecting to a different instance.

Web Session Affinity is a kind of a Connection Affinity which was provided by Oracle RAC Database starting from version 11.1.0.6

Connection Affinity allows a connection pool to select connections that are directed at a specific database instance. The connection pool uses run-time connection load balancing (RCLB) to select an Oracle RAC instance to create the first connection and then subsequent connections are created with an affinity to the same instance.
WebLogic GridLink Data Sources supports:
  • Transaction-based Affinity, 
  • Web Session Affinity and 
  • Data Affinity

The XA Affinity for global transactions ensures all the data base operations for a global transaction performed on an Oracle RAC cluster are directed to the same Oracle RAC instance. The affinity will be established based on the global transaction id, instead of by individual data source, to ensure that connections obtained from different data sources that are configured for the same RAC cluster are all associated with the same RAC instance.
This type of affinity should be used when:
  • the cost (in terms of performance) of being redirected to a new Oracle RAC instance is high (typically during the distributed transaction the cost of a connection redirection to a different Oracle RAC instance is significant) or
  • long-lived affinity to Oracle RAC instance is desired 
Transaction Affinity should be used form long-lived transactions, especially when the performance cost of being redirected to a new Oracle RAC instance is high.

Friday, April 4, 2014

ADF XML Files

Oracle ADF documentation describes a lot of XML files used internally in each ADF application. As documentation says the files are used by applications to:
  • Specify the parameters, methods, and return values available to your application's Oracle ADF data control usages
  • Create objects in the Oracle ADF binding context and define the runtime behavior of those objects
  • Define configuration information about the UI components in JSF and ADF Faces 
  • Define application configuration information for the Java EE application server
In the typical ADF application we are dealing with two main elements: model layer and view-controller layer.

Model layer

ADF Model implements concepts that enable decoupling the user interface technology from the business service implementation: data controls and declarative bindings.

Data control layer
In the data controllayer we have the data control implementation files: entity and view object definitions, view links definitions, application module definition files. Generally speaking, it is a set of files visible in a typical ADF Model porject. These files, in conjunction with the bc4j.xcfg file, provide the necessary information for the data control.

Data binding layer
In the each typical data aware view-controller project we can find a set of files responsible for "data binding" functionality:
  • DataBindings.cpx - one or more files. DataBinding.cpx defines the binding context for the entire application and provide the metadata from which the Oracle ADF binding objects are created at runtime. The file contains the page map, page definitions references and data control references, and thus maps individual pages to page definition files and declares which data controls are being used by the application.
  • adfm.xml: This file lists the DataBindings.cpx files that are available in the current project.
  • <pagename>PageDef.xml: Page definition XML files. They associates web page UI components with data and data controls.

Thursday, April 3, 2014

Problem with ADF and IE11

A new browser version released by Microsoft is not supported by ADF and what is worse, ADF web pages are not rendered at all. When you run ADF webpage in IE11, you will see message box:

Unsupported image

The problem is caused by ADF javascript layer, because in IE 11 the browser's User-Agent header has changed, and ADF no longer even recognizes the browser's product family. Additionally Oracle says, that "... internal testing has shown that there are many other changes in IE 11 that have an impact on ADF, and these all need to be evaluated before ADF can be certified for use with IE 11. Customers should bear in mind that, at this time, IE 11 has only recently been formally released, and the certification process takes some time."

To fix main part of problems with IE11 you should apply patch available on Oracle Support. The path is provided for JDeveloper/ADF 11.1.1.6.0, JDeveloper/ADF 11.1.1.7.0, JDeveloper/ADF 11.1.2.4.0 and JDeveloper/ADF 12.1.2.0.0.

Bellow I will show how to proceed with patch for ADF 11.1.1.7.0.

After you download zipped patch file run command line and go to unzipped path folder. By example:

C:\Users\mariusz\Downloads\PATCH_TOP>cd 18277370

Next you can start the first step of the path procedure:

C:\Users\mariusz\Downloads\PATCH_TOP\18277370>cd oui

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\oui>cd 18277370

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\oui\18277370>C:\Oracle\Middleware7\oracle_common\OPatch\opatch apply -jdk c:\oracle\jdk
Invoking Standalone OPatch 11.1.0.0.0

Oracle Standalone Interim Patch Installer version 11.1.0.0.0
Copyright (c) 2007, Oracle Corporation.  All rights reserved.


Oracle Home            : C:\Oracle\Middleware7\oracle_common
Oracle Home Inventory  : C:\Oracle\Middleware7\oracle_common\sainventory
OPatch version         : 11.1.0.0.0
Product information    : n/a
Log file location      : C:\Oracle\Middleware7\oracle_common\cfgtoollogs\opatch\opatch2014-03-07_13-34-09PM.log

ApplySession applying interim patch '18277370' to OH 'C:\Oracle\Middleware7\oracle_common'

Running prerequisite checks...

OPatch finds no 'product.xml' in Oracle Home and will attempt to create 'product.xml' file.

Attempting to retrieve patch inventory's "product" and its "version" information...

Please enter your choice to enable OPatch to create 'product.xml' file or quit creation...


Choice                          Product                         Version
------                          -------                         -------
1                               SA_JDEV                         11.1.1.7.0

2. If you wish, quit 'product.xml' creation

Please enter [1-2]:
1
User Responded with: 1

OPatch will put the information of selected product 'SA_JDEV' and selected version '11.1.1.7.0'
in product.xml during inventory updation.


OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = 'C:\Oracle\Middleware7\oracle_common')


Is the local system ready for patching?

Do you want to proceed? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '18277370' for restore. This might take a while...
Backing up files affected by the patch '18277370' for rollback. This might take a while...

Patching component oracle.jrf.adfrt, 11.1.1.7.0...
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\adf-richclient-api-11.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\adf-richclient-automation-11.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\adf-richclient-impl-11.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\adf.oracle.domain.webapp.war"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\dvt-faces.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\oracle-page-templates.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\trinidad-api.jar"
Copying file to "C:\Oracle\Middleware7\oracle_common\modules\oracle.adf.view_11.1.1\trinidad-impl.jar"
ApplySession adding interim patch '18277370' to inventory

Attempting to create/replace 'product.xml' as requested...

"C:\Oracle\Middleware7\oracle_common\product.xml" file under Oracle Home is successfully created.

Verifying the update...
Inventory check OK: Patch ID 18277370 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 18277370 are present in Oracle Home.

The local system has been patched and can be restarted.

OPatch succeeded.
OK. Path succeded, and we can start the next step:
C:\Users\mariusz\Downloads\PATCH_TOP\18277370\oui\18277370>set oracle_home=C:\Oracle\Middleware7\jdeveloper

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\oui\18277370>cd ..

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\oui>cd ..

C:\Users\mariusz\Downloads\PATCH_TOP\18277370>cd sa

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\sa>cd 18277370

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\sa\18277370>C:\Oracle\Middleware7\oracle_common\OPatch\opatch apply -jdk c:\oracle\jdk
Invoking Standalone OPatch 11.1.0.0.0

Oracle Standalone Interim Patch Installer version 11.1.0.0.0
Copyright (c) 2007, Oracle Corporation.  All rights reserved.


Oracle Home            : C:\Oracle\Middleware7\jdeveloper
Oracle Home Inventory  : C:\Oracle\Middleware7\jdeveloper\sainventory
OPatch version         : 11.1.0.0.0
Product information    : n/a
Log file location      : C:\Oracle\Middleware7\jdeveloper\cfgtoollogs\opatch\opatch2014-03-07_14-09-44PM.log

ApplySession applying interim patch '18277370' to OH 'C:\Oracle\Middleware7\jdeveloper'

Running prerequisite checks...

OPatch finds no 'product.xml' in Oracle Home and will attempt to create 'product.xml' file.

Attempting to retrieve patch inventory's "product" and its "version" information...

Please enter your choice to enable OPatch to create 'product.xml' file or quit creation...


Choice                          Product                         Version
------                          -------                         -------
1                               SA_JDEV                         11.1.1.7.0

2. If you wish, quit 'product.xml' creation

Please enter [1-2]:
1
User Responded with: 1

OPatch will put the information of selected product 'SA_JDEV' and selected version '11.1.1.7.0'
in product.xml during inventory updation.


OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = 'C:\Oracle\Middleware7\jdeveloper')


Is the local system ready for patching?

Do you want to proceed? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '18277370' for restore. This might take a while...
Backing up files affected by the patch '18277370' for rollback. This might take a while...

Patching component oracle.jdeveloper, 11.1.1.7.0...
Copying file to "C:\Oracle\Middleware7\jdeveloper\adfv\jlib\oracle-page-templates.jar"
Copying file to "C:\Oracle\Middleware7\jdeveloper\jlib\oracle-page-templates.jar"
ApplySession adding interim patch '18277370' to inventory

Attempting to create/replace 'product.xml' as requested...

"C:\Oracle\Middleware7\jdeveloper\product.xml" file under Oracle Home is successfully created.

Verifying the update...
Inventory check OK: Patch ID 18277370 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 18277370 are present in Oracle Home.

The local system has been patched and can be restarted.


OPatch succeeded.

C:\Users\mariusz\Downloads\PATCH_TOP\18277370\sa\18277370>