title: Database Connection Exception after a period of inactivity on a web application built with hibernate 3 and struts 2(SQL Error: 17410, SQLState: 08000)
body: <p>i have an exception every morning when i want to authenticate to web application that uses <code>hibernate 3</code>, i have searched for problem like solutions in stackoverflow and i used <code>c3p0</code> to avoid this exception, but now im not sure if the problem is in <code>hibernate</code> configuration or in database server, i workaround the problem by redeploying the war file in <code>Weblogic</code>,</p>
  
  <p><strong>the persistence.cfg.xml configuration is :</strong> </p>
  
  <pre><code>&lt;property name="hibernate.connection.driver_class"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
  &lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt;
  &lt;property name="hibernate.c3p0.max_size"&gt;30&lt;/property&gt;
  &lt;property name="hibernate.c3p0.timeout"&gt;300&lt;/property&gt;
  &lt;property name="hibernate.c3p0.max_statements"&gt;50&lt;/property&gt;
  &lt;property name="hibernate.c3p0.idle_test_period"&gt;3000&lt;/property&gt;
  &lt;property  name="hibernate.dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/property&gt;
  &lt;property name="show_sql"&gt;true&lt;/property&gt;
  &lt;property name="oracle.jdbc.allowedLogonVersion"&gt;12&lt;/property&gt;
  </code></pre>
  
  <p>the platform are (Oracle 12c, Weblogic 12c), </p>
  
  <p><strong>the message of exception is :</strong> </p>
  
  <pre><code>janv. 15, 2016 10:42:42 AM org.hibernate.util.JDBCExceptionReporter logExceptions
  AVERTISSEMENT: SQL Error: 17410, SQLState: 08000
  &lt;15 janv. 2016 10 h 42 WET&gt; &lt;Warning&gt; &lt;org.hibernate.util.JDBCExceptionReporter&gt; &lt;BEA-000000&gt; &lt;SQL Error: 17410, SQLState: 08000&gt;
  janv. 15, 2016 10:42:42 AM org.hibernate.util.JDBCExceptionReporter logExceptions
  GRAVE: Il n'y a plus de données à lire dans le socket
  &lt;15 janv. 2016 10 h 42 WET&gt; &lt;Error&gt; &lt;org.hibernate.util.JDBCExceptionReporter&gt; &lt;BEA-000000&gt; &lt;Il n'y a plus de données à lire dans le socket&gt;
  org.hibernate.exception.JDBCConnectionException: could not execute query
          at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
          at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
          at org.hibernate.loader.Loader.doList(Loader.java:2231)
          at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
          at org.hibernate.loader.Loader.list(Loader.java:2120)
          at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
          at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
          at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
          at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
          at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
          at persistance.BaseDAO.getListObject(BaseDAO.java:131)
          at dao.UserDao.listeUsers(UserDao.java:11)
          at presentation.LoginAction.login(LoginAction.java:35)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)
          at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:292)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
          at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
          at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
          at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
          at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
          at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
          at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
          at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
          at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
          at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
          at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511)
          at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
          at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
          at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
          at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
          at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
          at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
          at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
          at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
          at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
          at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
          at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
          at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
          at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
          at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  Caused by: java.sql.SQLRecoverableException: Il n'y a plus de données à lire dans le socket
          at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:456)
          at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:397)
          at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
          at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
          at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:225)
          at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:53)
          at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:774)
          at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:925)
          at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1111)
          at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4798)
          at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:4845)
          at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1501)
          at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
          at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
          at org.hibernate.loader.Loader.doQuery(Loader.java:697)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
          at org.hibernate.loader.Loader.doList(Loader.java:2228)
          ... 76 more
  could not execute query
  </code></pre>
  
  <p>Thanks</p>