java.lang.reflect.UndeclaredThrowableException

Hibernate JIRA | Karl von Randow | 9 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  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 | 9 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 | 9 months ago | Karl von Randow
    java.lang.reflect.UndeclaredThrowableException

    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