Skip to content

Commit 8542fc2

Browse files
author
Chris Cho
committed
DOCSP-26393: FAQ entry for NoClassDefFoundError (mongodb#425)
* DOCSP-26393: FAQ entry for NoClasDefFoundError (cherry picked from commit daee823)
1 parent 1e87483 commit 8542fc2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

source/api-documentation.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _java-api-landing:
2+
13
=================
24
API Documentation
35
=================

source/faq.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,30 @@ When ``MongoClient.close()`` is called by any thread, the driver
146146
closes all idle sockets and closes all sockets that are in
147147
use as they are returned to the pool.
148148

149+
How do I prevent the "java.lang.NoClassDefFoundError: com/mongodb/MongoClient" error?
150+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151+
152+
You may encounter a ``java.lang.NoClassDefFoundError`` exception when your
153+
Java runtime environment cannot locate a class file at runtime. When you
154+
attempt to run application code that uses the {+driver-long+}, you must include
155+
the appropriate driver JAR files on the classpath.
156+
157+
If you receive this error after adding the {+driver-short+} JAR files to
158+
your classpath, check the following items in your environment:
159+
160+
- The JAR files exist in the locations specified by the classpath.
161+
- The classpath syntax is correct.
162+
- If you define the classpath in an environment variable, the Java runtime
163+
environment uses that variable.
164+
- If you use a dependency manager, it does not report any unresolvable conflicts.
165+
166+
.. tip::
167+
168+
This error contains the package and class name, which can help you identify
169+
which driver JAR may be missing from your classpath. To locate the
170+
driver JAR that the error refers to, check each of the entries in the
171+
:ref:`API documentation <java-api-landing>`.
172+
149173

150174
How do I prevent the "IllegalArgumentException: Invalid BSON field name" error?
151175
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)