java.lang.reflect.UndeclaredThrowableException

Hibernate JIRA | Karl von Randow | 10 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    We have seen exceptions in production related to some misconfiguration of our Infinispan / JGroups clustering. Another story. What happened was an {{SQLException}} is thrown when Hibernate tried to release a {{ResultSet}}, this resulted in a {{RuntimeException}} (as the {{SQLException}} is rethrown as an {{UndeclaredThrowableException}}) and misses the {{connection.close()}} which leaves hanging connections and eventually connection starvation. What do you think about putting the {{connection.close()}} in {{JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190)}} into a finally block? Here is the exception stacktrace that we are seeing that is causing this issue: {code:java} java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy39.hashCode(Unknown Source) at java.util.HashMap.hash(HashMap.java:338) at java.util.HashMap.get(HashMap.java:556) at org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl.release(ResourceRegistryStandardImpl.java:76) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:157) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.release(AbstractBatchImpl.java:195) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190) at org.hibernate.internal.SessionImpl.close(SessionImpl.java:424) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.doClose(AbstractHibernateSessionInvocationHandler.java:230) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.actuallyClose(AbstractHibernateSessionInvocationHandler.java:218) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.invoke(AbstractHibernateSessionInvocationHandler.java:72) at com.sun.proxy.$Proxy66.actuallyClose(Unknown Source) at com.xk72.hibernate.session.internal.HibernateCurrentSessionProvider.completelyCloseCurrentSession(HibernateCurrentSessionProvider.java:157) at com.xk72.hibernate.session.internal.StandardHibernateSessionProvider.completelyCloseCurrentSession(StandardHibernateSessionProvider.java:82) at com.cactuslab.supermodel.utils.HibernateUtil.completelyCloseCurrentSession(HibernateUtil.java:65) at com.cactuslab.supermodel.web.SupermodelRootActionContext.doRootAction(SupermodelRootActionContext.java:152) at com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:143) at com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:69) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.cactuslab.supermodel.web.SupermodelFilter.doFilter(SupermodelFilter.java:58) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.csrf.CSRFFilter.doFilter(CSRFFilter.java:93) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.multipart.MultipartHttpFilter.doFilter(MultipartHttpFilter.java:31) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.RequestCharacterEncodingFilter.doFilter(RequestCharacterEncodingFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Statement closed. at org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$StatementProxy.invoke(StatementDecoratorInterceptor.java:238) ... 47 more {code}

    Hibernate JIRA | 10 months ago | Karl von Randow
    java.lang.reflect.UndeclaredThrowableException
  2. 0

    We have seen exceptions in production related to some misconfiguration of our Infinispan / JGroups clustering. Another story. What happened was an {{SQLException}} is thrown when Hibernate tried to release a {{ResultSet}}, this resulted in a {{RuntimeException}} (as the {{SQLException}} is rethrown as an {{UndeclaredThrowableException}}) and misses the {{connection.close()}} which leaves hanging connections and eventually connection starvation. What do you think about putting the {{connection.close()}} in {{JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190)}} into a finally block? Here is the exception stacktrace that we are seeing that is causing this issue: {code:java} java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy39.hashCode(Unknown Source) at java.util.HashMap.hash(HashMap.java:338) at java.util.HashMap.get(HashMap.java:556) at org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl.release(ResourceRegistryStandardImpl.java:76) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:157) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.release(AbstractBatchImpl.java:195) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190) at org.hibernate.internal.SessionImpl.close(SessionImpl.java:424) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.doClose(AbstractHibernateSessionInvocationHandler.java:230) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.actuallyClose(AbstractHibernateSessionInvocationHandler.java:218) at com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.invoke(AbstractHibernateSessionInvocationHandler.java:72) at com.sun.proxy.$Proxy66.actuallyClose(Unknown Source) at com.xk72.hibernate.session.internal.HibernateCurrentSessionProvider.completelyCloseCurrentSession(HibernateCurrentSessionProvider.java:157) at com.xk72.hibernate.session.internal.StandardHibernateSessionProvider.completelyCloseCurrentSession(StandardHibernateSessionProvider.java:82) at com.cactuslab.supermodel.utils.HibernateUtil.completelyCloseCurrentSession(HibernateUtil.java:65) at com.cactuslab.supermodel.web.SupermodelRootActionContext.doRootAction(SupermodelRootActionContext.java:152) at com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:143) at com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:69) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.cactuslab.supermodel.web.SupermodelFilter.doFilter(SupermodelFilter.java:58) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.csrf.CSRFFilter.doFilter(CSRFFilter.java:93) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.multipart.MultipartHttpFilter.doFilter(MultipartHttpFilter.java:31) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.xk72.webparts.RequestCharacterEncodingFilter.doFilter(RequestCharacterEncodingFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Statement closed. at org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$StatementProxy.invoke(StatementDecoratorInterceptor.java:238) ... 47 more {code}

    Hibernate JIRA | 10 months ago | Karl von Randow
    java.lang.reflect.UndeclaredThrowableException
  3. 0

    java.sql.SQLException: No value specified for parameter 1解决办法_IT知识问答_希赛网

    educity.cn | 2 years ago
    java.sql.SQLException: No value specified for parameter 1 代码如下 public boolean login(UserInfo user)throws Exception{ //用户登录 boolean flag=false; int userNo=Integer.parseInt(user.getUserNo()); String password=user.getPassword(); //测试是否从现在的user对象中取到了值 System.out.println(userNo+"我是USER对象的userNo"); System.out.println(password+"我是USER对象的password"); DatabaseConnection dbc=new DatabaseConnection();//取得数据库连接和关闭对象; try{ String sql="SELECT userNo FROM userInfo where userNo= and password= "; this.conn=dbc.getConnection(); this.pst=conn.prepareStatement(sql); //this.pst.setInt(1, userNo);//给sql中参数赋值 this.pst.setLong(1, userNo); this.pst.setString(2, password); ResultSet rs=pst.executeQuery(); if(rs.next()){//传入用户账号和对应的密码都存在时为真 flag=true; System.out.println(rs.getString(userNo)+"我是从数据库里取出来的"); System.out.print(flag+"测试flag");//测试flag,看是否进入了if里面,true则进入了 rs.close(); } }catch(Exception e){ e.printStackTrace(); }finally{ if(this.pst!=null){ this.pst.close(); } this.conn.close(); } return flag; } 报的错误信息如:
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.sql.SQLException: No suitable driver - Toolbox for IT Groups

    ittoolbox.com | 8 months ago
    java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager .java:545) at java.sql.DriverManager.getConnection(DriverManager .java:171) at com.stc.sql.framework.jdbc.DBConnectionFactory.cre ateConnection(DBConnectionFactory.java:372) at com.stc.sql.framework.jdbc.DBConnectionFactory.get Connection(DBConnectionFactory.java:281) at com.stc.etl.engine.impl.SimpleTask.getConnection(S impleTask.java:254) at com.stc.etl.engine.impl.Extractor.getSelectData(Ex tractor.java:376) at com.stc.etl.engine.impl.Extractor.process(Extracto r.java:190) at com.stc.etl.engine.impl.ETLTaskThread.run(ETLTaskT hread.java:147)
  6. 0

    1 more error - Java Programming Help - KnowCoding.com

    knowcoding.com | 2 years ago
    java.sql.SQLException: Protocol violation at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179) at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1160) at oracle.jdbc.ttc7.Ocommoncall.receive(Ocommoncall.j ava:149) at oracle.jdbc.ttc7.TTC7Protocol.rollback(TTC7Protoco l.java:488) at oracle.jdbc.driver.OracleConnection.rollback(Oracl eConnection.java:1412) at net.sf.hibernate.transaction.JDBCTransaction.rollb ack(JDBCTransaction.java:86) at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:90) at com.azure.spark.database.hibernate.util.HibernateU til.doSessionWork(HibernateUtil.java:59) at com.azure.spark.database.hibernate.util.HibernateU til.get(HibernateUtil.java:569) at com.azure.spark.database.hibernate.util.HibernateS ession.get(HibernateSession.java:340) at com.azure.spark.taskcontroller.TaskControllerCompo nent.taskCompleted(TaskControllerComponent.java:11 54) at com.azure.spark.taskcontroller.TaskControllerCompo nent.onTaskEvent(TaskControllerComponent.java:1111 ) at com.azure.spark.taskcontroller.tasks.AbstractTaskC omponent.run(AbstractTaskComponent.java:354)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      Statement closed.

      at org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$StatementProxy.invoke()
    2. org.apache.tomcat
      StatementDecoratorInterceptor$StatementProxy.invoke
      1. org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$StatementProxy.invoke(StatementDecoratorInterceptor.java:238)
      1 frame
    3. com.sun.proxy
      $Proxy39.hashCode
      1. com.sun.proxy.$Proxy39.hashCode(Unknown Source)
      1 frame
    4. Java RT
      HashMap.get
      1. java.util.HashMap.hash(HashMap.java:338)
      2. java.util.HashMap.get(HashMap.java:556)
      2 frames
    5. org.hibernate.resource
      ResourceRegistryStandardImpl.release
      1. org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl.release(ResourceRegistryStandardImpl.java:76)
      1 frame
    6. Hibernate
      SessionImpl.close
      1. org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:157)
      2. org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.release(AbstractBatchImpl.java:195)
      3. org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190)
      4. org.hibernate.internal.SessionImpl.close(SessionImpl.java:424)
      4 frames
    7. com.xk72.hibernate
      AbstractHibernateSessionInvocationHandler.invoke
      1. com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.doClose(AbstractHibernateSessionInvocationHandler.java:230)
      2. com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.actuallyClose(AbstractHibernateSessionInvocationHandler.java:218)
      3. com.xk72.hibernate.session.internal.AbstractHibernateSessionInvocationHandler.invoke(AbstractHibernateSessionInvocationHandler.java:72)
      3 frames
    8. com.sun.proxy
      $Proxy66.actuallyClose
      1. com.sun.proxy.$Proxy66.actuallyClose(Unknown Source)
      1 frame
    9. com.xk72.hibernate
      StandardHibernateSessionProvider.completelyCloseCurrentSession
      1. com.xk72.hibernate.session.internal.HibernateCurrentSessionProvider.completelyCloseCurrentSession(HibernateCurrentSessionProvider.java:157)
      2. com.xk72.hibernate.session.internal.StandardHibernateSessionProvider.completelyCloseCurrentSession(StandardHibernateSessionProvider.java:82)
      2 frames
    10. com.cactuslab.supermodel
      SupermodelRootActionContext.doRootAction
      1. com.cactuslab.supermodel.utils.HibernateUtil.completelyCloseCurrentSession(HibernateUtil.java:65)
      2. com.cactuslab.supermodel.web.SupermodelRootActionContext.doRootAction(SupermodelRootActionContext.java:152)
      2 frames
    11. com.xk72.webparts
      ActionFilter.doFilter
      1. com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:143)
      2. com.xk72.webparts.actions.ActionFilter.doFilter(ActionFilter.java:69)
      2 frames
    12. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    13. com.cactuslab.supermodel
      SupermodelFilter.doFilter
      1. com.cactuslab.supermodel.web.SupermodelFilter.doFilter(SupermodelFilter.java:58)
      1 frame
    14. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    15. com.xk72.webparts
      CSRFFilter.doFilter
      1. com.xk72.webparts.csrf.CSRFFilter.doFilter(CSRFFilter.java:93)
      1 frame
    16. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    17. com.xk72.webparts
      MultipartHttpFilter.doFilter
      1. com.xk72.webparts.multipart.MultipartHttpFilter.doFilter(MultipartHttpFilter.java:31)
      1 frame
    18. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      2 frames
    19. com.xk72.webparts
      RequestCharacterEncodingFilter.doFilter
      1. com.xk72.webparts.RequestCharacterEncodingFilter.doFilter(RequestCharacterEncodingFilter.java:30)
      1 frame
    20. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
      6. org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
      7. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
      8. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      9. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      10. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
      10 frames
    21. org.apache.coyote
      AjpProcessor.process
      1. org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190)
      1 frame
    22. Grizzly HTTP
      JIoEndpoint$SocketProcessor.run
      1. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
      2. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      2 frames
    23. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2 frames
    24. Tomcat Util
      TaskThread$WrappingRunnable.run
      1. org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      1 frame
    25. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame