-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: hibernate gets "java.net.SocketException: Connection re
PostPosted: Thu Dec 22, 2005 11:10 pm 
Newbie

Joined: Fri Nov 25, 2005 10:01 pm
Posts: 7
I have a web application using hibernate (c3p0) with mysql. It works on my development
machine, but when I upload it to the server, the server gets an error. The first user
page that accesses the database works fine, but the second and subsequent ones
give the error listed below. It seems as if something is happening like the jdbc connection
is not being closed, but I have a servelt filter with:
try {
chain.doFilter(request, response);
HibernateUtil.commitTransaction();
} finally {
HibernateUtil.closeSession();
}

any ideas?


Hibernate version:
3.1

Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/parvia?autoReconnect=true</property>
<property name="connection.username">parvia</property>
<property name="connection.password">mriPN39e</property>

<!-- JDBC connection pool -->
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Mapping files -->
<mapping resource="com/parvia/account/Address.hbm.xml"/>
<mapping resource="com/parvia/account/Customer.hbm.xml"/>
<mapping resource="com/parvia/account/Transaction.hbm.xml"/>
<mapping resource="com/parvia/parvix/Piece.hbm.xml"/>
<mapping resource="com/parvia/parvix/Facade.hbm.xml"/>
<mapping resource="com/parvia/system/ReferenceNumber.hbm.xml"/>
</session-factory>

</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Connection reset

STACKTRACE:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:113)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:75)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:94)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:122)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1842)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2292)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2788)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2291)
at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:496)
at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:756)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:37)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:315)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1262)
at com.parvia.system.HibernateUtil.beginTransaction(HibernateUtil.java:65)
.
.
.

Name and version of the database you are using:
MySQL

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
18:57:17,585 DEBUG SessionImpl:272 - opened session at timestamp: 4650215986606080
18:57:17,600 DEBUG JDBCTransaction:54 - begin
18:57:17,603 DEBUG ConnectionManager:313 - opening JDBC connection
18:57:17,772 DEBUG JDBCExceptionReporter:63 - Cannot open connection [???]
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.