Re: Exception in hibernate3 relating to timeout

2011-02-25 Thread Mark Eggers
- Original Message (edited) 
From: Filip Hanik - Dev Lists 

Use a different connection pool that can properly handle your timeouts 
when idle.
http://people.apache.org/~fhanik/jdbc-pool/
http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

Filip

On 02/24/2011 11:31 PM, abhishek jain wrote:
> hi,
> I am not sure if i am ringing the correct list, but i am sure people here
> must have encountered this problem. I am new to hibernate and when i ran the
> code on server it was fine , strangely next day it keep on giving this error
> till i restart tomcat.
>
> The last packet successfully received from the server was 54,880,316
> milliseconds ago.  The last packet sent successfully to the server was
> 54,880,317 milliseconds ago. is longer than the server configured value of
> 'wait_timeout'. You should consider either expiring and/or testing
> connection validity before use in your application, increasing the server
> configured values for client timeouts, or using the Connector/J connection
> property 'autoReconnect=true' to avoid this problem.
>
> I have searched a lot on net and added the following properties on
> hibernate.cfg.xml, as people there were suggesting this,but of no use.
> 
> 
> 5
> 20
> 300
> 50
> 3000
> thread


- Original Message (edited) 

Agreed, a better pooling system would be preferable. A Wiki entry on how to 
couple Hibernate and Tomcat's JNDI pooling can be found here:

http://wiki.apache.org/tomcat/TomcatHibernate

If you add a validation query to your Resource definition, then you can recover 
from stale connections. For MySQL, the validation query is:

validationQuery="SELECT 1"

So in the Wiki example (from above), the modified context.xml file would look 
like:






Apparently another way you can do this is with C3P0 properties - in particular 
connection testing.

Documentation can be found on the web. See:

http://community.jboss.org/wiki/HowToconfiguretheC3P0connectionpool
http://www.mchange.com/projects/c3p0/index.html#appendix_a

for pointers. You can define a preferredTestQuery, but I am unsure if you have 
to use HQL syntax or the validationQuery listed above.

Also according to the references, extra C3P0 properties need to be placed in a 
separate c3p0.properties file that lives somewhere on the application's class 
path. To make sure your property file ends up in WEB-INF/classes, you'll have 
to 
figure out where to place it in MyEclipse.

I've not tried connection testing with C3P0, since I use the Tomcat-managed 
connection pooling mechanism.

. . . . just my two cents.

/mde/


  

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Exception in hibernate3 relating to timeout

2011-02-25 Thread Filip Hanik - Dev Lists
Use a different connection pool that can properly handle your timeouts 
when idle.

http://people.apache.org/~fhanik/jdbc-pool/
http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

Filip

On 02/24/2011 11:31 PM, abhishek jain wrote:

hi,
I am not sure if i am ringing the correct list, but i am sure people here
must have encountered this problem. I am new to hibernate and when i ran the
code on server it was fine , strangely next day it keep on giving this error
till i restart tomcat.

The last packet successfully received from the server was 54,880,316
milliseconds ago.  The last packet sent successfully to the server was
54,880,317 milliseconds ago. is longer than the server configured value of
'wait_timeout'. You should consider either expiring and/or testing
connection validity before use in your application, increasing the server
configured values for client timeouts, or using the Connector/J connection
property 'autoReconnect=true' to avoid this problem.

I have searched a lot on net and added the following properties on
hibernate.cfg.xml, as people there were suggesting this,but of no use.


5
20
300
50
3000
thread



Pl. help me.
I have used hibernate3 with myeclipse as the development environment, and am
using mysql 5.x and centos (Linux) with Tomcat 5.x
   



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Exception in hibernate3 relating to timeout

2011-02-24 Thread abhishek jain
hi,
I am not sure if i am ringing the correct list, but i am sure people here
must have encountered this problem. I am new to hibernate and when i ran the
code on server it was fine , strangely next day it keep on giving this error
till i restart tomcat.

The last packet successfully received from the server was 54,880,316
milliseconds ago.  The last packet sent successfully to the server was
54,880,317 milliseconds ago. is longer than the server configured value of
'wait_timeout'. You should consider either expiring and/or testing
connection validity before use in your application, increasing the server
configured values for client timeouts, or using the Connector/J connection
property 'autoReconnect=true' to avoid this problem.

I have searched a lot on net and added the following properties on
hibernate.cfg.xml, as people there were suggesting this,but of no use.


5
20
300
50
3000
thread



Pl. help me.
I have used hibernate3 with myeclipse as the development environment, and am
using mysql 5.x and centos (Linux) with Tomcat 5.x
-- 
Thanks and kind Regards,
Abhishek jain