Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when exception thrown in underlying getConnection() #112

Open
alex-kormukhin opened this issue Jul 1, 2024 · 0 comments

Comments

@alex-kormukhin
Copy link

datasource-proxy version: 1.10.

If underlying data source throw some SQL exception in getConnection() method, datasource-proxy mask that exception and crashes with NullPointerException with stack like this:

java.lang.NullPointerException: Cannot invoke "net.ttddyy.dsproxy.ConnectionInfo.getConnectionId()" because "connectionInfo" is null
	at net.ttddyy.observation.tracing.DataSourceObservationListener.handleGetConnectionAfter(DataSourceObservationListener.java:262)
	at net.ttddyy.observation.tracing.DataSourceObservationListener.afterMethod(DataSourceObservationListener.java:207)
	at net.ttddyy.dsproxy.listener.CompositeMethodListener.afterMethod(CompositeMethodListener.java:25)
	at net.ttddyy.dsproxy.proxy.ProxyLogicSupport.proceedMethodExecution(ProxyLogicSupport.java:114)
	at net.ttddyy.dsproxy.support.ProxyDataSource.getConnectionProxy(ProxyDataSource.java:83)
	... 16 common frames omitted
Wrapped by: net.ttddyy.dsproxy.DataSourceProxyException: Failed to perform getConnection
	at net.ttddyy.dsproxy.support.ProxyDataSource.getConnectionProxy(ProxyDataSource.java:88)
	at net.ttddyy.dsproxy.support.ProxyDataSource.getConnection(ProxyDataSource.java:73)
	at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:160)
	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:118)
	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:342)
	at org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator.getProduct(DataSourceHealthIndicator.java:122)
	at org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator.doDataSourceHealthCheck(DataSourceHealthIndicator.java:105)
	at org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator.doHealthCheck(DataSourceHealthIndicator.java:100)
	at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant