Skip to content

DataSourceProperties fail to bind if java.sql module isn't included #41082

@xenoterracide

Description

@xenoterracide

I'm actually not certain if this is actually fixable as long as spring boot doesn't have its own module-info. Note: this results in a stacktrace later on startup, but I think this log is the root cause of that.

Failed to bind properties under 'spring.datasource' to org.springframework.boot.autoconfigure.jdbc.DataSourceProperties:

    Reason: java.lang.ClassNotFoundException: javax.sql.DataSource
Caused by: java.lang.ClassNotFoundException: java.sql.SQLException
	at [email protected]/org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:72) ~[spring-boot-3.3.0.jar:na]
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1144) ~[tomcat-embed-core-10.1.24.jar:10.1.24]

adding this to module-info.java will fix

  requires java.sql;

boot 3.3.0 java 17

repro.tar.gz

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions