Unable to support mongodb+srv// style connections as the ‘com.sun.jndi.dns.DnsContextFactory’

Hello,

I was using without any mongo related issue a Java maven project with Java 8 and mongo spring reactive. Currently, I’m trying to upgrade the same Java 8 project to Java 11 (jvm 11.0.8+10-LTS). My updated spring boot version is 2.5.6 with Jetty server (9.4.44.v20210927), and the corresponding Mongo reactive version is based on 2.5.6. When Spring is trying to create the mongo related beans in order to add them in the context the following error appears:

Unable to support mongodb+srv// style connections as the ‘com.sun.jndi.dns.DnsContextFactory’ "
+ "class is not available in this JRE. A JNDI context is required for resolving SRV records
Can you please advise me with a solution?

I found that is a bug and was fixed in a previous version (https://jira.mongodb.org/browse/JAVA-3402) however it seems to be present in my mongo version.