Two Laptop Bag*
The moose likes JDBC and the fly likes MYSQL Connection Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MYSQL Connection Error " Watch "MYSQL Connection Error " New topic
Author

MYSQL Connection Error

bhuvana mounagurusamy
Greenhorn

Joined: Sep 21, 2006
Posts: 5
Hai all..

I am Using Hibernate3.1 ,MySQL 4.1 and JBoss 4.1 in my Application..

Using mysql-connector-java-3.1.13-bin Connecter to Connect JDBC


After deploying the Application It is runing fine.. If i open the same Application next day it is showing following stacktrace and after that it is working.. I tried to find the solution but i did't get yet..

Please help me..

Hibernate.Cng.xml is
-----------------

<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/pivot?autoReconnect=true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password">pivot</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="myeclipse.connection.profile">PivotRecruit</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="hbm2ddl.auto">update</property>

<property name="c3p0.min_size">10</property>
<property name="c3p0.max_size">100</property>
<property name="c3p0.timeout">10</property>
<property name="c3p0.acquireRetryAttempts">30</property>
<property name="c3p0.acquireIncrement">5</property>
<property name="c3p0.idleConnectionTestPeriod">300</property>
<property name="c3p0.initialPoolSize">20</property>
<property name="c3p0.maxPoolSize">100</property>
<property name="c3p0.maxIdleTime">300</property>
<property name="c3p0.maxStatements">50</property>
<property name="c3p0.minPoolSize">10</property>
<property name="c3p0.preferredTestQuery">SELECT 1,</property>
<property name="c3p0.testConnectionOnCheckin">true</property>
<property name="c3p0.testConnectionOnCheckOut">false</property>

<mapping resource="com/pivot/recruit/Customer.hbm.xml"></mapping>
<mapping resource="com/pivot/recruit/HiringManager.hbm.xml"></mapping>
......

My Stack Trace is
--------------

21:15:41,062 INFO [STDOUT] Hibernate: select profiles0_.profileid as profileid0_, profiles0_.jobid as jobid3_0_, profiles0_.createdby as createdby3_0_, profiles0_.name as name3_0_, profiles0_.email as email3_0_, profiles0_.cellphone as cellphone3_0_, profiles0_.homephone as homephone3_0_, profiles0_.workphone as workphone3_0_, profiles0_.workaddress as workaddr9_3_0_, profiles0_.homeaddress as homeadd10_3_0_, profiles0_.profloc as profloc3_0_, profiles0_.salexp as salexp3_0_, profiles0_.recentsalary as recents13_3_0_, profiles0_.comments as comments3_0_, profiles0_.resumepath as resumepath3_0_, profiles0_.assignedto as assignedto3_0_, profiles0_.status as status3_0_, profiles0_.datecreated as datecre18_3_0_, profiles0_.updatedby as updatedby3_0_, profiles0_.dateupdated as dateupd20_3_0_ from pivot.profiles_table profiles0_ where profiles0_.profileid=?
21:17:14,453 INFO [STDOUT] Hibernate: select customer0_.id as id, customer0_.name as name0_, customer0_.address as address0_, customer0_.weburl as weburl0_, customer0_.contactperson as contactp5_0_, customer0_.alternativecontact as alternat6_0_, customer0_.accountmanager as accountm7_0_, customer0_.datecreated as datecrea8_0_, customer0_.datemodified as datemodi9_0_ from customer customer0_ order by customer0_.name
21:17:14,468 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 08S01
21:17:14,468 ERROR [JDBCExceptionReporter] Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Software caused connection abort: socket write error

STACKTRACE:

java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2692)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2621)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1552)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.pivot.recruit.bl.RecruitManager.getCustomers(RecruitManager.java:42)
at com.pivot.recruit.struts.action.CustomerListAction.execute(CustomerListAction.java:52)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)


** END NESTED EXCEPTION **

21:17:37,062 INFO [STDOUT] Hibernate: select hiringmana0_.hmid as hmid, hiringmana0_.customer_id as customer2_1_, hiringmana0_.name as name1_, hiringmana0_.phone as phone1_, hiringmana0_.cell as cell1_, hiringmana0_.fax as fax1_, hiringmana0_.email as email1_, hiringmana0_.date_created as date8_1_, hiringmana0_.date_modified as date9_1_ from pivot.hiring_manager hiringmana0_ order by hiringmana0_.name
21:17:40,656 INFO [STDOUT] Hibernate: select customer0_.id as id, customer0_.name as name0_, customer0_.address as address0_, customer0_.weburl as weburl0_, customer0_.contactperson as contactp5_0_, customer0_.alternativecontact as alternat6_0_, customer0_.accountmanager as accountm7_0_, customer0_.datecreated as datecrea8_0_, customer0_.datemodified as datemodi9_0_ from customer customer0_ order by customer0_.name
21:19:43,250 INFO [STDOUT] Hibernate: select profiles0_.profileid as profileid, profiles0_.jobid as jobid3_, profiles0_.createdby as createdby3_, profiles0_.name as name3_, profiles0_.email as email3_, profiles0_.cellphone as cellphone3_, profiles0_.homep

Thanks in Advance...
Bhuvana
George Stoianov
Ranch Hand

Joined: Jan 15, 2006
Posts: 94

java.net.SocketException
MESSAGE: Software caused connection abort: socket write error


Check that you have proper network connectivity i.e. if the app is on one server and the db on another that there is actually good connectivity throughout the day. If you are using a connection pool make sure you adjust the parameters accordingly so that connections do not stay to long or too little which would cause the app to think there is a connection when it is actually already gone. From the message I would start from network connectivity first.

Good luck!
George
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MYSQL Connection Error