Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: problem wiht Hibernate and tomcat connecting to mysql
PostPosted: Fri Jul 30, 2004 3:52 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:31 am
Posts: 42
hi all,
i have a webapp taht uses Hibernate and MYSQL, running on top of tomcat.
i am letting Hibernate handle the connections to mysql db, since i have no connection pools defined in tomcat.
after running the application for nearly 9 hours, when i tried to use my app to connect to the database i got following exception:

Caused by: net.sf.hibernate.JDBCException: Could not execute query
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1476)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:45)
at com.myapp.hibernate.HibernatePersistenceManager.query(HibernatePersistenceManager.java:205)
... 31 more
Caused by: java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Software caused connection abort: recv failed

STACKTRACE:

java.net.SocketException: Software caused connection abort: recv failed

i searched the web and found two solutions:
one was to add following properties to hibernate config file

<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>

that didnt worked.

the other one was to add autoReconnect=true to jdbc URL.

and unfortunately that didnt work either, coz i left the applicatoin running for 11 hours and then i got same exception

Please, can anyone help me out?

thanx and regards
marco



but this does not work, as ihave added thos eproperties to hibernate properties file and i am still getting same exception

anyone can help on theissue?

thanx in advance adn regards
marco


--------------------------------------------------------------------------------

Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 11:02 am 
Newbie

Joined: Fri Apr 02, 2004 2:22 pm
Posts: 11
Try adding the following to your hibernate.xml:

Code:
      
<property name="dbcp.maxActive">100</property>
<property name="dbcp.whenExhaustedAction">1</property>
<property name="dbcp.maxWait">120000</property>
<property name="dbcp.maxIdle">1</property>
<property name="dbcp.minIdle">0</property>
<property name="dbcp.ps.maxActive">10</property>
<property name="dbcp.ps.whenExhaustedAction">1</property>
<property name="dbcp.ps.maxWait">120000</property>
<property name="dbcp.ps.maxIdle">100</property>
   
<!-- Optional query to validate pooled connections -->
<property name="dbcp.validationQuery">select 1</property>
<property name="dbcp.testOnBorrow">true</property>
<property name="dbcp.testOnReturn">false</property>


Make sure you also have the following set in your hibernate.xml:

Code:
<property name="hibernate.connection.url">jdbc:mysql://localhost:8080/dbtable</property>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.username">someuser</property>
<property name="hibernate.connection.password">somepwd</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.