Skip to content

DOCS-16093 - JNDI documentation update #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions source/fundamentals/connection/jndi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Connect to MongoDB by Using a JNDI Datasource
:depth: 2
:class: singlecol

.. facet::
:name: genre
:values: tutorial

.. meta::
:keywords: code example, wildfly, tomcat

Overview
--------
Expand All @@ -31,9 +37,15 @@ JNDI Datasource.
:tabid: wildfly

1. In a `Wildfly <https://wildfly.org/>`__ installation, create a new module
for MongoDB at ``modules/system/layers/base/org/mongodb/main``. Copy the
``mongo-java-driver.jar`` jar file into the module. Add the following
``module.xml`` file into the module:
for MongoDB at ``modules/system/layers/base/org/mongodb/main``. Copy
the following jar files into the module:

- ``mongodb-driver-sync-{+full-version+}.jar``
- ``mongodb-driver-core-{+full-version+}.jar``
- ``bson-{+full-version+}.jar``
- ``bson-record-codec-{+full-version+}.jar``

Add the following ``module.xml`` file into the module:

.. literalinclude:: /includes/fundamentals/code-snippets/wildfly-module-with-version.xml
:language: xml
Expand Down Expand Up @@ -67,8 +79,13 @@ JNDI Datasource.
.. tab:: Tomcat
:tabid: tomcat

1. Copy the ``mongo-java-driver.jar`` jar file into the ``lib`` directory
of your `Tomcat <https://tomcat.apache.org/>`__ installation.
1. Copy the following jar files into the ``lib`` directory
of your `Tomcat <https://tomcat.apache.org/>`__ installation:

- ``mongodb-driver-sync-{+full-version+}.jar``
- ``mongodb-driver-core-{+full-version+}.jar``
- ``bson-{+full-version+}.jar``
- ``bson-record-codec-{+full-version+}.jar``

#. In the ``context.xml`` file of your application, add a resource that references
the ``MongoClientFactory`` class and the :ref:`connection string
Expand All @@ -78,7 +95,7 @@ JNDI Datasource.

<Resource name="mongodb/MyMongoClient"
auth="Container"
type="com.mongodb.MongoClient"
type="com.mongodb.client.MongoClient"
closeMethod="close"
factory="com.mongodb.client.MongoClientFactory"
singleton="true"
Expand Down