javamongodbeclipsewildflymyeclipse

ClassNotFoundException jdk.net.* in Wildfly


My app just started blowing up on startup after upgrading to latest MongoDB drivers. Using Wildfly 19, JDK14, and I've confirmed that at compile time jdk.net.* are available. Clearly they're either not making it into the runtime environment or there is a security issue. My guess is that the module is being blocked, but I've not been able to figure out how to get access to it.

Log output:

13:28:07,673 INFO  [org.mongodb.driver.cluster] (cluster-ClusterId{value='5f304e47acf25e32b55f0c16', description='null'}-srv-cluster0-hpilc.azure.mongodb.net) Adding discovered server cluster0-shard-00-00-hpilc.azure.mongodb.net:27017 to client view of cluster
13:28:07,675 INFO  [org.mongodb.driver.cluster] (cluster-ClusterId{value='5f304e47acf25e32b55f0c16', description='null'}-srv-cluster0-hpilc.azure.mongodb.net) Adding discovered server cluster0-shard-00-01-hpilc.azure.mongodb.net:27017 to client view of cluster
13:28:07,783 INFO  [org.mongodb.driver.cluster] (cluster-ClusterId{value='5f304e47acf25e32b55f0c16', description='null'}-cluster0-shard-00-02-hpilc.azure.mongodb.net:27017) Exception in monitor thread while connecting to server cluster0-shard-00-02-hpilc.azure.mongodb.net:27017: com.mongodb.MongoException: java.lang.NoClassDefFoundError: jdk/net/ExtendedSocketOptions
    at deployment.goa.war//com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:157)
    at deployment.goa.war//com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188)
    at deployment.goa.war//com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.NoClassDefFoundError: jdk/net/ExtendedSocketOptions
    at deployment.goa.war//com.mongodb.internal.connection.SocketStreamHelper.setExtendedSocketOptions(SocketStreamHelper.java:83)
    at deployment.goa.war//com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:53)
    at deployment.goa.war//com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79)
    at deployment.goa.war//com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)
    at deployment.goa.war//com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143)
    ... 3 more
Caused by: java.lang.ClassNotFoundException: jdk.net.ExtendedSocketOptions from [Module "deployment.goa.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 8 more```

Solution

  • Figured it out. In the Wildfly standalone.xml file add

    <global-modules>
    <module name="jdk.net" slot="main" />            
    </global-modules>
    

    inside of the block