Thanks Jon!  That fixed the problem.

After some trial and error, it appears that "validationQuery" was the
specific dataSource property that fixed the CommunicationsException problem.

I was seeing an AbandonedObjectPool error when I had removeAbandoned set to
true.  Was that the MySQL pooling exception you were seeing?

Thanks again.


jonl wrote:
> 
> Hi, 
> I encountered something similar and approached it by tweaking the
> datasource bean: 
> 
>     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>         <property name="url"
> value="jdbc:mysql://x.x.x.x/db?useUnicode=true&amp;characterEncoding=utf-8"/>
>         <property name="username" value="root"/>
>         <property name="password" value=""/>
>         <property name="maxActive" value="100"/>
>         <property name="maxIdle" value="30"/>
>         <property name="maxWait" value="1000"/>
>         <property name="defaultAutoCommit" value="true"/>
>         <property name="removeAbandoned" value="true"/>
>         <property name="removeAbandonedTimeout" value="60"/>
>         <property name="validationQuery">
>               <value>SELECT 1</value>
>         </property>
>         <property name="testOnBorrow" value="true"/>        
>     </bean> 
> 
> I've only experienced it with MySql, never with Oracle. The above is not
> necessarily the final solution though. After deploying, I still have had a
> MySql pooling exception. May have missed using another property. 
> 
> Do NOT consider using the c3p0 DB pooling implementation. 
> 
> Regards, 
> Jon
> 
> 
> java_user_ wrote:
>> 
>> Has anyone figured out what is causing the CommunicationsException after
>> 8+ hours on idle time?
>> It is a stale connection and adding "autoReconnect=true" in the JDBC URL
>> has not fixed the issue.
>> 
>> There appears to be a few threads on the forum discussing the issue but I
>> have not seen a final resolution...
>> 
>> Thanks  
>> 
>> 
>> org.springframework.transaction.CannotCreateTransactionException: Could
>> not open Hibernate Session for transaction; nested exception is
>> org.hibernate.TransactionException: JDBC begin failed:
>> Caused by: org.hibernate.TransactionException: JDBC begin failed:
>>         at
>> org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
>>         at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>         at 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/CommunicationsException-tp18569133s2369p18715109.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to