Oracle Maximum Availability Architecture (MAA) with JBoss EAP managed connection pools
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
Issue
- Can I use connections from Oracle's Universal Connection Pool (UCP) in container managed transactions in JBoss EAP?
- How do I configure a JBoss EAP datasource to use Oracle's UCP?
- Using EAP7 with Oracle UCP
- Oracle Transparent Application Continuity (TAC) with JBoss EAP 7.4
Resolution
Disclaimer: Links contained herein to external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.
Scope
This document is limited to discussion of application components which require access to Oracle Maximum Availability Architecture (MAA) features in the context of code which is using JBoss EAP container managed transactions (CMT) or which uses the JBoss EAP implementation of javax.transaction.UserTransaction in bean managed transaction (BMT) scenarios. Application components which do not utilize CMT or BMT code may be coded directly against the Oracle connectivity libraries and, as such, would not be subject to the considerations discussed in this document (since they would not utilize integration between the JBoss EAP container services and Oracle database connectivity code).
Minimum System Requirements
When using the Oracle MAA with JBoss EAP, Red Hat recommends the following:
- JBoss EAP 7.4 Update 1 (or later) / JBoss EAP 7.3 Update 8 (or later)
- Due to security and functionality fixes, Red Hat recommends the latest available cumulative patch be applied in all production systems.
- JDK 111
- JBoss EAP managed pools using Oracle MMA enabled configuration must be configured as non-XA pools (i.e. use
<datasource>rather than<xa-datasource>).- At most, a single non-XA resource can safely participate in any transaction.
-
For fault tolerance the following should be configured
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker"/> <validate-on-match>true</validate-on-match> <background-validation>false</background-validation> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/> - The
FailingConnectionOnlyflush strategy should be used (i.e. use the EAP pool default). - EAP pooled connection statement caching should not be enabled (i.e. use the EAP pool default).
Testing and Support
- Red Hat does not test Oracle specific failover or application continuity features.
- Red Hat does test connectivity to Oracle for documented version families of the Oracle database and driver.
- JBoss EAP has no direct visibility of Oracle-specific database functionality which is not explicitly part of the JDBC 4 specification2.
- For questions about specific Oracle functionality or specific configuration, consult Oracle documentation or Oracle Support services.
- Red Hat Support provides assistance with:
- Analysis of symptoms that indicate incorrect use (originating in JBoss EAP bundled code) of the JDBC 4 API.
- Guidance in applying JVM level or pool-specific configuration that is explicitly recommended by Oracle3.
References
-
Or a later version of the JDK which is tested by Red Hat for use with JBoss EAP) ↩︎
-
Limited exceptions to this include Oracle specific exception sorters and validation mechanisms utilized in fault tolerance configuration and Oracle specific SQL and behavior related to interaction with the database through the Hibernate API. ↩︎
-
Note that Oracle will provide specific recommendations for properties that need to be set to configure the Oracle driver but the manner in which these are exposed to the Oracle driver may be JBoss EAP specific (e.g. properties may need to be set in JBoss configuration using JBoss CLI commands). ↩︎
Root Cause
- Application code that requires Java Enterprise Edition (EE) features such as container managed transactions (CMT) or bean managed transactions (BMT)1 may only use connections from JBoss EAP managed pools (in any transaction) to ensure transaction ACID properties can be maintained.
- To access Oracle connection caching and FCF (Fast Connection Failover) with Oracle RAC (Real Application Clusters), it's necessary to use Oracle's UCP (Universal Connection Pool)2.
- EAP does not delegate requests to the underlying JDBC driver each time a connection is requested by application components. Instead, connections obtained from the underlying driver are pooled within EAP (until they time out or are evicted from the pool due to validation failure).
- Pooling outside of the Oracle driver is only possible with the JBoss JCA integration with beginRequest/endRequest lifecycle hooks for
java.sql.Connection.
-
Bean managed transactions will use
javax.transaction.UserTransaction↩︎
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
8 Comments
Hello,
I've tested this configuration with Oracle RAC 11g.
Just two notes from my side:
In the $JBOSS_HOME/server/$INSTANCE/lib you need:
ojdbc6.jar
ons.jar
ucp.jar
And following the examples of UCP, you need to use the long style URL in the driver.
For example:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource>
<jndi-name>ReclamacionesDS</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<no-tx-separate-pools/>
<xa-datasource-class>oracle.ucp.jdbc.PoolXADataSourceImpl</xa-datasource-class>
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- set the JBoss connection pool idle-timeout to as low as it will go so that the JBoss pool doesn't hold on to the connections unnecessarily -->
<idle-timeout-minutes>1</idle-timeout-minutes>
<!-- set the JBoss connection pool min size to 0 so that the JBoss pool doesn't grab and hold the connections from the Oracle pool unnecessarily -->
<min-pool-size>0</min-pool-size>
<xa-datasource-property name="MinPoolSize">1</xa-datasource-property>
<!-- set the JBoss connection pool max size to the same as the Oracle connection pool max size -->
<max-pool-size>50</max-pool-size>
<xa-datasource-property name="MaxPoolSize">50</xa-datasource-property>
<xa-datasource-property name="InactiveConnectionTimeout">0</xa-datasource-property>
<xa-datasource-property name="TimeToLiveConnectionTimeout">0</xa-datasource-property>
<xa-datasource-property name="AbandonedConnectionTimeout">0</xa-datasource-property>
<xa-datasource-property name="ConnectionWaitTimeout">0</xa-datasource-property>
<xa-datasource-property name="PropertyCycle">900</xa-datasource-property>
<xa-datasource-property name="ValidateConnectionOnBorrow">true</xa-datasource-property>
<xa-datasource-property name="ConnectionPoolName">myCache</xa-datasource-property>
<xa-datasource-property name="FastConnectionFailoverEnabled">true</xa-datasource-property>
<xa-datasource-property name="ONSConfiguration">nodes=host1,host2</xa-datasource-property>
<xa-datasource-property name="ConnectionFactoryClassName">oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-property>
<xa-datasource-property name="Password">jboss</xa-datasource-property>
<xa-datasource-property name="User">jboss</xa-datasource-property>
<xa-datasource-property name="URL">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=servjboss)))</xa-datasource-property>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</xa-datasource>
</datasources>
Hello Lucas, the above example does work? What was the JBOSS EAP version that you used?
Greetings.
Alejandro.
Hello Alejandro,
I performed these tests some time ago using EAP 5 version.
Thanks,
Lucas
Hello Lucas,
It's a bit confusing, you mention that you used ucp.jar and ons.jar, but UCP is not supported by Red Hat according to the resolution note above.
I understand that I should only set the connection-url in the standalone-full.xml config file, and store the jar files in the lib directory. Red Hat support wise, should this be OK? I don't want to have support issues.
I am implementing this with Red Hat 7, JBoss EAP 6.3, ojdbc7.jar
Thanks a lot ! BR
Hello,
can you tell me, where to find this RFE (request for enhancement) PRODMGT-69?
Thanks,
Mike
Michel,
PRODMGT-69 is a reference to an internal tracking system. I will remove to avoid confusion. There would be considerable changes to the JCA implementation in order to achieve this but it is being considered for EAP 7.
Thanks,
John Lee
Hello Johnathon, Is there any news about new features of Jboss EAP (e.g Jboss EAP 6.0.3) that supports the UCP (Universal Connection Pool)to take advantage of the RAC Oracle features?
Thanks.
Alejandro.
Has this been tested yet on JBOSS EAP 7 yet ? Does Redhat certify the solution or are we still on the same solution provided above?