-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Creation of auto-configured DataSource fails when using UCP and the environment contains a non-enumerable property source such as JndiPropertySource #38514
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
Comments
Thanks for the report. The problem's occurring because @Test
void testDataSourceExistsWithNonEnumerablePropertySource() {
this.contextRunner.withInitializer((context) -> {
context.getEnvironment().getPropertySources().addFirst(new PropertySource<String>("name") {
@Override
public Object getProperty(String name) {
return null;
}
});
}).run((context) -> {
assertThat(context.getBeansOfType(DataSource.class)).hasSize(1);
assertThat(context.getBeansOfType(PoolDataSourceImpl.class)).hasSize(1);
try (Connection connection = context.getBean(DataSource.class).getConnection()) {
assertThat(connection.isValid(1000)).isTrue();
}
});
} As far as I can tell, we've already addressed this in 3.2.0 through the changes made for #38201, although it's something of an unintended side-effect. We may want to back port that change to 3.1.x or consider a different fix. @fmeheust can you please try 3.2.0 (released earlier today) and let us know if it fixes the problem? |
@wilkinsona I can't find 3.2.0 in maven central, where can I get it ? |
It's in Maven Central. See https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/3.2.0/, for example. Note that sites like https://search.maven.org/ take some time to catch up to new releases and as such aren't a great source of up-to-date information. |
@wilkinsona I confirm that my application starts correctly on spring boot 3.2.0. Thank you |
Thanks, @fmeheust. |
We discussed this today and feel that backporting #38201 is a bit risky. We're going to recommend that folks with this issue upgrade to 3.2.x. |
Spring boot fails to start when using UCP and Spring Boot 3.1.5 with JndiPropertySource enabled.
This happens because UCP exposes a property SSLConext of type javax.net.ssl.SSLContext. The constructor for SSLContext has a parameter of type java.security.Provider. This Provider class implements Map and is therefore treated by Spring Boot as a Map, an attempt will be made to create a Map using CollectionFactory which will cause the error because java.security.Provider does not expose a constructor with no parameters.
The following workarounds are possible :
spring.jndi.ignore=true
This is the error when deploying the WAR on a Tomcat server:
The text was updated successfully, but these errors were encountered: