Skip to content

DataSourceBuilder triggers an NPE in Hikari when trying to build a DataSource with a JDBC URL for an unknown driver #44994

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 Apr 4, 2025 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

DataSourceBuilder.create()
	.url("jdbc:example://localhost:1234/example")
	.type(HikariDataSource.class)
	.build();
java.lang.NullPointerException
	at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.base/java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1541)
	at java.base/java.lang.ClassLoader.getClassLoadingLock(ClassLoader.java:671)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:651)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at com.zaxxer.hikari.HikariConfig.attemptFromContextLoader(HikariConfig.java:973)
	at com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:483)
	at org.springframework.boot.jdbc.DataSourceBuilder$MappedDataSourceProperty.set(DataSourceBuilder.java:480)
	at org.springframework.boot.jdbc.DataSourceBuilder$MappedDataSourceProperties.set(DataSourceBuilder.java:374)
	at org.springframework.boot.jdbc.DataSourceBuilder.build(DataSourceBuilder.java:193)
	…

It should leave the driver class name unset if it cannot be derived from the JDBC URL.

@wilkinsona wilkinsona added the type: bug A general bug label Apr 4, 2025
@wilkinsona wilkinsona added this to the 3.3.x milestone Apr 4, 2025
@wilkinsona wilkinsona self-assigned this Apr 4, 2025
@wilkinsona wilkinsona changed the title DataSourceBuilder triggers an NPE in Hikari when trying to build a DataSource with a JDBC URL that is unknown DataSourceBuilder triggers an NPE in Hikari when trying to build a DataSource with a JDBC URL for an unknown driver Apr 4, 2025
@wilkinsona wilkinsona modified the milestones: 3.3.x, 3.3.11 Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant