Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
MongoDB driver 4.4.0 throws UnsupportedAddressTypeException with Java 17

I have problems with the latest mongodb driver 4.4.0 on my Linux machine with Java 17. It throws following exception:

  Exception java.io.UncheckedIOException: java.net.SocketException: Unsupported address type
        at DatagramSocketAdaptor.connect (DatagramSocketAdaptor.java:120)
        at DatagramSocket.connect (DatagramSocket.java:474)
        at DnsClient.doUdpQuery (DnsClient.java:408)
        at DnsClient.query (DnsClient.java:214)
        at Resolver.query (Resolver.java:81)
        at DnsContext.c_getAttributes (DnsContext.java:434)
        at ComponentDirContext.p_getAttributes (ComponentDirContext.java:235)
        at PartialCompositeDirContext.getAttributes (PartialCompositeDirContext.java:141)
        at PartialCompositeDirContext.getAttributes (PartialCompositeDirContext.java:129)
        at InitialDirContext.getAttributes (InitialDirContext.java:171)
        at DefaultDnsResolver.resolveAdditionalQueryParametersFromTxtRecords (DefaultDnsResolver.java:114)
        at ConnectionString.<init> (ConnectionString.java:388)
        at (#5:1)
  Caused by: java.net.SocketException: Unsupported address type
        at Net.translateToSocketException (Net.java:187)
        at DatagramSocketAdaptor.connectInternal (DatagramSocketAdaptor.java:95)
        at DatagramSocketAdaptor.connect (DatagramSocketAdaptor.java:118)
        ...
  Caused by: java.nio.channels.UnsupportedAddressTypeException
        at Net.checkAddress (Net.java:161)
        at DatagramChannelImpl.connect (DatagramChannelImpl.java:1217)
        at DatagramSocketAdaptor.connectInternal (DatagramSocketAdaptor.java:91)
        ...

It works as expected on my Windows with Java 17 and also on that Linux with Java 11.

How do I test it:

$ jshell --class-path mongodb-driver-core-4.4.0.jar

jshell> import com.mongodb.ConnectionString;

jshell> ConnectionString cs = new ConnectionString("mongodb+srv://xyz.mongodb.net/");

Expected result is javax.naming.NameNotFoundException: DNS name not found, however actual result is the java.nio.channels.UnsupportedAddressTypeException.

Any idea how to make it work?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

After a lot of "jdbing" I found out, that I can make it work with older implementation of DatagramSocketImpl as is stated here https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/DatagramSocketImpl.html

I.e. if I set jdk.net.usePlainDatagramSocketImpl system property to "true" then it works.

Although I don't know proper solution or the real cause of the problem, I can live with the workaround and it works for me.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda