Skip Ribbon Commands
Skip to main content
Navigate Up
Sign In

Quick Launch

Average Rating:

facebook Twitter
Email
Print Bookmark Alert me when this article is updated

Feedback

HOW TO: Reconnect RulePoint and RTAM automatically to their database server after a connectivity loss
Solution

The C3PO/Hibernate configurations for both RulePoint and Real-Time Alert Manager (RTAM) can be altered so that the C3PO refreshes its' stale connections and re-establishes connections to the database server once connectivity is restored (with the default configuration a Tomcat restart is required).

 

Here are the changes that need to be made. Ensure to make backup copies of the following files before making any changes. After making these changes, ensure to restart Tomcat to have them take effect.
Note
For the hibernate.c3p0.preferredTestQuery, a query specific to Oracle was used. If your database platform is MS SQL Server 2005/2008, you can use this query, select getdate(). If your database platform is IBM DB2 9.5/9.7, you can use the following query:
SELECT current date as date FROM sysibm.sysdummy1
 

RulePoint

In rulepoint/WEB-INF/spring/applicationContext.xml:
 
In the dataSource bean entry, do the following:
  1. Change <property name="breakAfterAcquireFailure" value="true"/> to equal false.
  2. Add the following three properties at the end of this bean entry:
    <property name="testConnectionOnCheckin" value="${hibernate.c3p0.testConnectionOnCheckin}"/>
    <property name="preferredTestQuery" value="${hibernate.c3p0.preferredTestQuery}"/>
    <property name="acquireRetryAttempts" value="${hibernate.c3p0.acquireRetryAttempts}"/>
In rulepoint/WEB-INF/classes/ jdbc.properties:
 
Add the following properties at the end of the EDIT section:
hibernate.c3p0.testConnectionOnCheckin=true
hibernate.c3p0.preferredTestQuery=SELECT 1 FROM DUAL
hibernate.c3p0.acquireRetryAttempts=0

RTAM

In RTAM/WEB-INF/classes/hibernate.xml:
 
In the dataSource bean entry, add the following three properties at the end of this bean entry:
<property name="testConnectionOnCheckin" value="${hibernate.c3p0.testConnectionOnCheckin}"/>
<property name="preferredTestQuery" value="${hibernate.c3p0.preferredTestQuery}"/>
<property name="acquireRetryAttempts" value="${hibernate.c3p0.acquireRetryAttempts}"/>
<property name="breakAfterAcquireFailure" value="${hibernate.c3p0.breakAfterAcquireFailure}"/>
 
In the sessionFactory bean entry, add the following three properties at the end of this bean entry: 
<prop key="hibernate.c3p0.testConnectionOnCheckin">${hibernate.c3p0.testConnectionOnCheckin}</prop>
<prop key="hibernate.c3p0.preferredTestQuery">${hibernate.c3p0.preferredTestQuery}</prop>
<prop key="hibernate.c3p0.acquireRetryAttempts">${hibernate.c3p0.acquireRetryAttempts}</prop>
<prop key="hibernate.c3p0.breakAfterAcquireFailure">${hibernate.c3p0.breakAfterAcquireFailure}</prop>
 
In RTAM/WEB-INF/classes/rtam-config.properties:
 
Add the following properties at the end of the Hibernate tuning configuration section:
hibernate.c3p0.testConnectionOnCheckin=true
hibernate.c3p0.preferredTestQuery=SELECT 1 FROM DUAL
hibernate.c3p0.acquireRetryAttempts=0
hibernate.c3p0.breakAfterAcquireFailure=false
More Information

​Here are examples of some of the warnings and errors you may see in the Tomcat and RulePoint logs if database connectivity is lost:

 

[WARN ] ThreadPoolAsynchronousRunner: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@53761ed1 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

 

[WARN ] BasicResourcePool: Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@1d5959c2
java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection

 

[WARN ] BasicResourcePool: Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection

 

[WARN ] NewPooledConnection: [c3p0] Another error has occurred [ java.sql.SQLException: No more data to read from socket ] which will not be reported to listeners!

 

java.sql.SQLException: No more data to read from socket

 

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

 

Reference
Applies To
Product: Complex Event Processing
Problem Type:
User Type:
Project Phase:
Product Version: Real-Time Alert Manager 3.1; Real-Time Alert Manager 3.1 HotFix; RulePoint 5.1; RulePoint 5.2; RulePoint 5.2 HotFix
Database: DB2 UDB 9.5; DB2 UDB 9.7; Microsoft SQL Server 2005; Microsoft SQL Server 2008; Oracle 10g; Oracle 11g; Oracle 11g R2
Operating System: AIX 5.3; AIX 6.1; Linux; Redhat Linux AS 5.0; SUSE Linux ES 10.0; SUSE Linux ES 11.0; Windows 2003; Windows 2008; Windows Server 2008 R2
Other Software:
Attachments
Last Modified Date:12/26/2012 12:51 AMID:145512
People who viewed this also viewed

Feedback

Did this KB document help you?



What can we do to improve this information (2000 or fewer characters)