由于 Spring 中的 SQLException 导致 UndeclaredThrowableException +伊巴蒂斯?
当我输入错误的 SQL 驱动程序名称或数据库服务器脱机时,我会收到以下异常,基本上是任何 SQLException。
我无法确定 UndeclaredThrowableException 来自何处。 SqlMapClientTemplate 中的第 194 行是这样的:
logger.debug("Obtained JDBC Connection [" + springCon + "] for iBATIS operation");
这是跟踪:
java.lang.reflect.UndeclaredThrowableException $Proxy59.toString(Unknown Source) java.lang.String.valueOf(Unknown Source) java.lang.StringBuffer.append(Unknown Source) org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:290)
我的一些阅读指向某种类型的类加载问题?我不知道 $Proxy 是在哪里引入的?
I am getting the following exception when I typo the SQL driver name or the database server is offline, basically any SQLException.
I can't determine where the UndeclaredThrowableException is coming from. Line 194 in SqlMapClientTemplate is this:
logger.debug("Obtained JDBC Connection [" + springCon + "] for iBATIS operation");
Here is the trace:
java.lang.reflect.UndeclaredThrowableException $Proxy59.toString(Unknown Source) java.lang.String.valueOf(Unknown Source) java.lang.StringBuffer.append(Unknown Source) org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:290)
some of my reading points to some type of class loading problem? I can't figure out where the $Proxy is getting introduced?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$Proxy59
类必须是springCon
变量的类型。它是一个JDK代理类型,可能是Spring框架引入的,作为真实连接的包装器。我知道有一个池化连接提供程序,它返回通过代理抑制close()
方法的连接(因为连接是池化的,调用 close 不是客户端的任务)。也许代理的 toString() 方法的处理程序会抛出一个已检查的异常,这对于代理机制来说是可能的,但不允许。
Java 文档 说:
您是否记录了任何其他异常(可能是在该异常之前),或者提到了异常原因?
The
$Proxy59
class must be the type of thespringCon
variable. It is a JDK proxy type, probably introduced by the Spring framework, as a wrapper for the real connection. I know of a pooled connection provider that returns connections which suppress theclose()
method via a proxy (because the connection is pooled, calling close is not the client's task).Maybe the proxy's handler for the
toString()
method throws a checked exception, which is possible with the proxy mechanics, but not allowed.The Java Documentation says:
Do you get any other exception logged, maybe directly before that, or mentioned as the exception cause?