Hi all,
I am implementing an application using a linux machine, Tomcat4, mysql 3.23.58, and hibernate 2.1.6.
I have a problem when my database machine is turn off. I mean, my application works fine when Tomcat has connection with database machine (this is my log4j logs):
Code:
[Thread-17] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - processing result set
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - result row: 2
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 2
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.optivamedia.lysis.PPVEvent#2
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - done processing result set (1 rows)
[Thread-17] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
[Thread-17] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
[Thread-17] DEBUG net.sf.hibernate.loader.Loader - total objects hydrated: 1
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.optivamedia.lysis.PPVEvent#2]
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.optivamedia.lysis.PPVEvent#2]
[Thread-17] DEBUG net.sf.hibernate.cache.ReadWriteCache - Caching: 2
[Thread-17] DEBUG net.sf.hibernate.cache.EhCache - key: 2
[Thread-17] DEBUG net.sf.hibernate.cache.ReadWriteCache - Item was already cached: 2
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.optivamedia.lysis.PPVEvent#2]
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
[Thread-17] DEBUG net.sf.hibernate.transaction.JDBCTransaction - commit
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
[Thread-17] DEBUG net.sf.hibernate.impl.Printer - listing entities:
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - post flush
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
[Thread-17] DEBUG net.sf.hibernate.transaction.JDBCTransaction - re-enabling autocommit
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
[Thread-17] DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
But if I turn off my database machine, it appears that the transaction hangs:
Code:
[Thread-5] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
[Thread-5] DEBUG net.sf.hibernate.transaction.JDBCTransaction - begin
and no more until a lot of minutes. Then I get a java.net.NoRouteToHostConnection exception. So, my question is how can I decrease the time the transaction knows that there is no route to the database machine?
It is extrange, because if I stop my database (software stop), the transaction returns me a NoRouteToHostConnection exception in very few time.
So, what can be the problem? Do you need more information?
Thanks in advance.
Mariano.