Skip to content

Commit f05b226

Browse files
author
Chris Cho
committed
DOCSP-26393: FAQ entry for NoClassDefFoundError (#425)
* DOCSP-26393: FAQ entry for NoClasDefFoundError (cherry picked from commit daee823)
1 parent 02b4d94 commit f05b226

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
@@ -151,6 +151,30 @@ When ``MongoClient.close()`` is called by any thread, the driver
151151
closes all idle sockets and closes all sockets that are in
152152
use as they are returned to the pool.
153153

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

155179
How do I prevent the "IllegalArgumentException: Invalid BSON field name" error?
156180
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)