-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problem with MySql Connection
PostPosted: Wed Oct 04, 2006 3:59 am 
Newbie

Joined: Mon Sep 25, 2006 8:54 am
Posts: 6
Pleas help. I am using hibernate 3.1.3. and integrated with struts application. I am using mySql as the database with hibernate connection. I deployed it as a war file in weblogic 8.1. It is working fine. But when is keep it open this application and next day access the program it fails at JDBC part and gives the follwing error.
But when i redeploy it is working fine.




org.hibernate.exception.JDBCConnectionException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2148)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java
:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.sas.test.Connect$ResponseData.<init>(Unknown Source)
at com.sas.test.MapDemoDrillServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure d
ue 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:66
)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2686)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1546)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1660)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2988)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:930)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
1024)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java
:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.sas.test.Connect$ResponseData.<init>(Unknown Source)
at com.sas.test.MapDemoDrillServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)


** END NESTED EXCEPTION **



Last packet sent to the server was 16 ms ago.
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2704)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1546)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1660)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2988)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:930)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
1024)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:
139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 19 more


regards,
Subhash


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 11:13 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
What connection pool are you using? Multiple issues can create this problem. The most likely is that your tcp/ip socket to the database just drops. If you are using c3p0 you can set it up to check idle connections after a given interval, it looks like 1 hr would do it in your case.

This error can also be generated if you are running sql outside a transaction or if there is some error in the mysql server. The first cause above is the most likely in your case.

I hope this helps,

Marius


Top
 Profile  
 
 Post subject: Re: Problem with MySql Connection
PostPosted: Thu Oct 05, 2006 1:36 am 
Newbie

Joined: Mon Sep 25, 2006 8:54 am
Posts: 6
Hi Marius,
Thanks for ur reply. I am using Weblogic connection(from JNDI look up).
The problem still exists. But if i redepoly it is working....Please suggest..

MY config file as follows:

<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="/dao/hibernate/Tutorial.hbm.xml"/>
</session-factory>
</hibernate-configuration>

regards,
Subhash


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 12:36 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Subhash,

Can you share some of the code? Best to write a simpler test class... will help you to isolate the problem AND many more people will give you some advice.

Marius


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.