-->
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.  [ 12 posts ] 
Author Message
 Post subject: After almost 1 day hibernate says: could not execute Query
PostPosted: Thu Dec 06, 2007 1:52 pm 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
Hi everybody:

I am newbie using hibernate framework. I have made a web application that uses hibernate to insert, update and delete entities in a mysql database. I generated the map xml files and the dao classes and objects entities with MyEclipse 6.0 that work very well, but I'm having a problem:

When I deployed the web application to the tomcat 6.0 and start the tomcat service, everything work fine the inserts delete and retrieve work very well, but after one day when I'm going to use the aplication I get this error from the application: "Could not execute query" and of course nathing works then when I restart the tomcat 6.0 service everything work fine again.
I don't know why is this happening to the aplication ??? Could you help me please to find how to fix this ?
I hope you can help me.
Greetings
Ariel


Top
 Profile  
 
 Post subject: Re: After almost 1 day hibernate says: could not execute Que
PostPosted: Thu Dec 06, 2007 2:12 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
isaacrc82 wrote:
Hi everybody:

I am newbie using hibernate framework. I have made a web application that uses hibernate to insert, update and delete entities in a mysql database. I generated the map xml files and the dao classes and objects entities with MyEclipse 6.0 that work very well, but I'm having a problem:

When I deployed the web application to the tomcat 6.0 and start the tomcat service, everything work fine the inserts delete and retrieve work very well, but after one day when I'm going to use the aplication I get this error from the application: "Could not execute query" and of course nathing works then when I restart the tomcat 6.0 service everything work fine again.
I don't know why is this happening to the aplication ??? Could you help me please to find how to fix this ?
I hope you can help me.
Greetings
Ariel


Can you send us full error description, a stack trace and the code part that has the problem?

Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 2:56 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

I feel that you running out of session object.
i.e)you have utilized all the session object in the sessionfactory.

Check to see whether you have closed the session properly.

Do post the extra information to analyze?

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 4:28 am 
Newbie

Joined: Fri Aug 31, 2007 11:58 am
Posts: 19
Yaa it could be case of classic problem of lost connections.

_________________
Note:Don't forget to rate,if useful.

Blog:http://elope.wordpress.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 4:36 am 
Newbie

Joined: Fri Aug 31, 2007 11:58 am
Posts: 19
Which hibernate version you are using ,Also check you connection pooling mechanism.
This bug was reported and subsequently fixed.
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1669?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel

_________________
Note:Don't forget to rate,if useful.

Blog:http://elope.wordpress.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 9:27 am 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
I hope you can help me.
This is the stack trace

Hibernate: select tblusers0_.id as id10_, tblusers0_.user as user10_, tblusers0_.password as password10_, tblusers0_.firstName as firstName10_, tblusers0_.lastName as lastName10_, tblusers0_.email as email10_ from sri.tbl_users tblusers0_ where tblusers0_.user=?
org.hibernate.exception.JDBCConnectionException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.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.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at cu.co.cenatav.hibernate.model.TblUsersDAO.findByProperty(TblUsersDAO.java:84)
at cu.co.cenatav.services.ServiceUserImpl.getUserByUsername(ServiceUserImpl.java:59)
at cu.co.cenatav.struts.action.LoginAction.execute(LoginAction.java:60)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
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(Loader.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.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at cu.co.cenatav.hibernate.model.TblUsersDAO.findByProperty(TblUsersDAO.java:84)
at cu.co.cenatav.services.ServiceUserImpl.getUserByUsername(ServiceUserImpl.java:59)
at cu.co.cenatav.struts.action.LoginAction.execute(LoginAction.java:60)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)


** END NESTED EXCEPTION **



Last packet sent to the server was 1703 ms ago.
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2579)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
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(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 28 more
could not execute query


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 10:04 am 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
I'm using hibernate 3.
Is this bug: http://opensource.atlassian.com/project ... y-tabpanel present in hibernate 3.1 too ???


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 10, 2007 10:50 am 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
Hi every body:
I have seen this post http://dev.mysql.com/doc/refman/5.0/en/ ... 24-4-5-3-4 It is explained that mysql conector/J closes conections after 8 hour of inactivity but I am newbie with hibernate and I don't know how to deal with this problem using hibernate, could you help me with that ? Could you explain me how do I reconnect with hibernate, sorry I think these are a very basics questions but I am learning.
I hope you can help me.
Greetings
Ariel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 11, 2007 9:00 am 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
Could Anyboody help me please ? How Can I deal with the problem I have explained before and hibernate ?
I hope somebody help me.
Greetings


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 11, 2007 10:09 am 
Beginner
Beginner

Joined: Wed Apr 26, 2006 4:40 am
Posts: 24
What data source do you use?

I would recommend spring's JndiDataSource or c3po's ComboPooledDataSource


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 11, 2007 6:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
In many setups mysql closes the connections due to inactivity - to most common solution is to manage this through the settings in your JDBC connection pool.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 10:00 am 
Newbie

Joined: Fri Aug 17, 2007 1:45 pm
Posts: 9
Could you tell me how to do that ??? How do I manage those settings with hibernate ???


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