This list is for the discussion of Hibernate development, not the usage of Hibernate. You should post this on the forum:

http://forum.hibernate.org

The advice you followed only makes sense if you were already using C3P0, so when you post on the forum, please include all Hibernate config options and full stack traces.

-Chris

Xinsheng Chen wrote:
Hi,

I am using
hibernate-3.2.6.ga

mysql-connector-java-5.1.5

spring-framework-2.5.1

liferay-portal-tomcat-6.0-4.3.6

My portlet application runs fine for most of the time.
However, in the morning when I run the Web application
and save user input into the database at the first
try, it throws exception. I got the following from
Tomcat Catalina.out.

2008-05-06 14:41:17,461 WARN
[org.springframework.web.portlet.DispatcherPortlet] -
Handler execution resulted in exception - forwarding
to resolved error view

org.springframework.transaction.CannotCreateTransactionException:
Could not open Hibernate Session for transaction;
nested exception is
org.hibernate.TransactionException: JDBC begin failed:

        at
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:521)

        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

        at java.lang.Thread.run(Thread.java:619)

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
org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:490)

        ... 110 more

Caused by:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure

I have browsed some Web sites. It is said that the
problem is stale database connection. Following the
advice I have added the following lines in my
hibernate configuration file:

                                                <prop
key="hibernate.c3p0.acquire_increment">3</prop>

                                                <prop
key="hibernate.c3p0.idle_test_period">30</prop>

                                                <prop
key="hibernate.c3p0.timeout">60</prop>

                                                <prop
key="hibernate.c3p0.max_size">15</prop>

                                                <prop
key="hibernate.c3p0.max_statements">0</prop>

                                                <prop
key="hibernate.c3p0.min_size">3</prop>

But it does not help.

Any help would be appreciated!

Regards,

Robert Chen



      
____________________________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to