Integration with Wildfly 27.0.1, jndi

I have been trying to create a connection in Wildfly 27.0.1 following the reference for the mongo java driver 4.9.

Unfortunately I cannot go past an error sying that the module cannot be loaded.

I have checked pretty much all I could and I am pretty sure I got it to work with a previous release of Wildfly.

Here is the module.xml I put in $WILDFLY_HOME/modules/system/layer/base/org/mongodb/main/

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.9" name="org.mongodb">
   <resources>
      <resource-root path="mongodb-driver-core.4.9.0.jar"/>
      <resource-root path="mongodb-driver-sync-4.9.0.jar"/>
   </resources>
   <dependencies>
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
      <module name="javax.servlet.api" optional="true"/>
   </dependencies>
</module>

together with .jar files.

I have tried with core, sync or both as in the last case.

Here is the entry in standalone-full.xml

 <subsystem xmlns="urn:jboss:domain:naming:2.0">
            <bindings>
                <object-factory name="java:jboss/jndi/MongoDBClient" module="org.mongodb" class="com.mongodb.client.MongoClientFactory">
                    <environment>
                        <property name="connectionString" value="mongodb://localhost:27017"/>
                    </environment>
                </object-factory>
            </bindings>
            <remote-naming/>
        </subsystem>

and the error I get

ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 73) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "naming"),
    ("binding" => "java:jboss/jndi/MongoDBClient")
]) - failure description: "WFLYNAM0052: Could not load module org.mongodb"

Many thanks

I had to change the module.xml to

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.9" name="org.mongodb">
   <resources>
      <resource-root path="bson.4.9.0.jar"/>
      <resource-root path="mongodb-driver-core.4.9.0.jar"/>
      <resource-root path="mongodb-driver-sync-4.9.0.jar"/>
   </resources>
   <dependencies>
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
      <module name="javax.servlet.api" optional="true"/>
   </dependencies>
</module>

in order to include also the bson dependency to get it to work.