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.  [ 10 posts ] 
Author Message
 Post subject: net.sf.hibernate.exception.GenericJDBCException
PostPosted: Wed Aug 31, 2005 7:28 am 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
I get the exception that is listed below and i really cant find out why. The exception dont always come, but when its thrown is there nothing i can do except restarting the Tomcat Service, when i have done that it can run for
Im using v2.0 of Hibernate and MySql v4 on a Tomcat 5.5


Here is the full stracktrace:


2005-08-31 02:39:34 StandardWrapperValve[saleDetails.jsp]: Servlet.service() for servlet saleDetails.jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.ShowGallery.saleDetails_jsp._jspService(saleDetails_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

2005-08-31 08:13:26 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: net.sf.hibernate.exception.GenericJDBCException: Could not execute query
at hibernate.xml.dm.Forsale.getForsaleDataList(Forsale.java:137)
at sale.bl.gallery.GetForsaleData.getRecordsForGallery(GetForsaleData.java:30)
at org.apache.jsp.ShowGallery.gallery_jsp._jspService(gallery_jsp.java:139)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.hibernate.exception.GenericJDBCException: Could not execute query
at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90)
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at hibernate.xml.dm.Forsale.getForsaleDataList(Forsale.java:133)
... 32 more
Caused by: java.sql.SQLException: Lost connection to server during query
at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
at org.gjt.mm.mysql.PreparedStatement.executeQuery(Unknown Source)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:88)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
... 34 more


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 8:39 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Which connection pool are you using?

Please post your config files.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 8:44 am 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Here is my config file:

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

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>

<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/sale</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="show_sql">true</property>

<!-- mapping files -->
<mapping resource="hibernate/xml/dm/Forsale.hbm.xml"/>
<mapping resource="hibernate/xml/dm/Tmpimage.hbm.xml"/>
<mapping resource="hibernate/xml/dm/Images.hbm.xml"/>
<mapping resource="hibernate/xml/dm/Vote.hbm.xml"/>
<mapping resource="hibernate/xml/dm/Buy.hbm.xml"/>

</session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 9:45 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Do these errors occur after the application has been running for a while?

There is a known issue with the built in connection pool for hibernate, mainly that it's awful and clearly marked as awful.

Either use C3P0 connection pooling or a JNDI datasource.

Code:
      <property name="c3p0.max_size">5</property>
      <property name="c3p0.min_size">2</property>
      <property name="c3p0.timeout">5000</property>
      <property name="c3p0.max_statements">100</property>
      <property name="c3p0.idle_test_period">3000</property>
      <property name="c3p0.acquire_increment">2</property>
      <property name="c3p0.validate">true</property>


This is a sample C3P0 connection pool. Try it and see if it works.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 11:42 am 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Yes, it come after some time!
I did not know that there were some issues with Hibernate's connection pool!

Ill look into another solution tomorrow for connection. Perhaps you can suggest at very good open source ??

Thx for the reply :-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 1:17 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Use C3P0 then. Problem solved.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 2:18 pm 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Ok, ill use that for connection.
Just wondering why they not have solved it if there is a problem ?

Thank you for the help


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 2:21 pm 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
I don't think they plan to solve it, because they say the Hibernate connection pool it's not for production use. Development only.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 3:26 pm 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Okay - sounds interesting. I used the Hibernate that there is build in MyEclipseIde and they use Hibernate's own connection-pool, so i assumed that it were working allright. Wonder if i should let MyEclipseIde take a look at this threat then.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 3:50 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
I'd imagine most people are quite aware of this and the prominent warning is quite a giveaway. The hibernate pool is used by default as most people will usually pick the most suitable connection pool for the purpose, but it is necessary to provide some form of connection pool to get people started.


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