Skip to content

DataSourceHealthIndicator fails on Java 7+ and MySQL with "Conversion not supported for type java.lang.Object" #1306

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

Closed
wilkinsona opened this issue Jul 29, 2014 · 1 comment
Milestone

Comments

@wilkinsona
Copy link
Member

This question on StackOverflow caused me to look into this. The failure is specific to Java 7 and later as ResultSet.getObject(index, type) is new in Java 7. The call to this method fails as the type that the health indicator passes in is java.lang.Object and MySQL's JDBC driver apparently doesn't know how to create one.

You could argue that by passing in java.lang.Object MySQL's JDBC driver should feel free to return whatever it wants rather than throwing an exception, but that's not the case and we should work around it if possible.

@wilkinsona wilkinsona added this to the 1.1.5 milestone Jul 29, 2014
@wilkinsona
Copy link
Member Author

Enabling auto-deserialization on the connection is one way to work around the problem:

spring.datasource.url: jdbc:mysql://localhost/test?autoDeserialize=true

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