title: MongoDB DataSource Configuration In JBoss Server
body: <p>How to configure MongoDB DataSource JNDI in JBoss Server.
  I downloaded MongoDB jar (<strong>mongo-java-driver-3.4.2.jar</strong>) and deployed using admin console, it got successfully deployed but when I went to add Datasource in customize option I am not able to see MongoDB driver, the only one option available was h2. Why so? Do I have to do any other configuration change or am I missing any step?</p>
  
  <p>I Even tried to manually create the MongoDB driver and datasource but that is also not working.
  I placed module.xml and mongo-java-driver- 3.4.2.jar to the following path 
  ..\devstudio\runtimes\jboss-eap\modules\system\layers\base\org\mongodb\main</p>
  
  <pre><code>--------- module.xml ---------------------
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module xmlns="urn:jboss:module:1.0" name="org.mongodb"&gt;
  &lt;resources&gt;
  &lt;resource-root path="mongo-java-driver-3.4.2.jar"/&gt;
  &lt;/resources&gt;
  &lt;dependencies&gt;
  &lt;module name="javax.api"/&gt;
  &lt;module name="javax.transaction.api"/&gt;
  &lt;/dependencies&gt;
  &lt;/module&gt;
  
  --------------standalone.xml ------------
  
  &lt;datasource jndi-name="java:jboss/datasources/mongodb" pool-name="mongodb" 
  enabled="true" use-java-context="true"&gt;
    &lt;connection-url&gt;jdbc:mongodb://127.0.0.1:27017/example;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE&lt;/connection-url&gt;
     &lt;driver&gt;mongodb&lt;/driver&gt;
   &lt;/datasource&gt;
  &lt;driver name="mongodb" module="org.mongodb"&gt;
     &lt;xa-datasource-class&gt;mongodb.jdbc.MongoXADataSource&lt;/xa-datasource-class&gt;
   &lt;/driver&gt;
  </code></pre>
  
  <p>I was getting the following error when i started the server </p>
  
  <pre><code>("subsystem" =&gt; "datasources"),
  ("data-source" =&gt; "mongodb")
  ]) - failure description: {"WFLYCTL0180: Services with missing/unavailable 
  dependencies" =&gt; [
  "org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
  "jboss.driver-demander.java:jboss/datasources/mongodb is missing 
  [jboss.jdbc-driver.mongodb]"
  ]}
  23:51:44,277 ERROR [org.jboss.as.controller.management-operation] 
  (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
  ("subsystem" =&gt; "datasources"),
  ("data-source" =&gt; "mongodb")
  ]) - failure description: {"WFLYCTL0180: Services with missing/unavailable 
  dependencies" =&gt; [
  "org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
  "jboss.driver-demander.java:jboss/datasources/mongodb is missing 
  [jboss.jdbc-driver.mongodb]",
  "org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]"
  ]}
  </code></pre>
  
  <p>Could you let me know how to do JNDI Datasource configuration in JBoss Server ?? Please explain in detail as I am new for JNDI Configuration</p>