Skip to content

DOCSP-26393: FAQ entry for NoClassDefFoundError #425

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
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions source/api-documentation.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _java-api-landing:

=================
API Documentation
=================
Expand Down
24 changes: 24 additions & 0 deletions source/faq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,30 @@ When ``MongoClient.close()`` is called by any thread, the driver
closes all idle sockets and closes all sockets that are in
use as they are returned to the pool.

How do I prevent the "java.lang.NoClassDefFoundError: com/mongodb/MongoClient" error?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You may encounter a ``java.lang.NoClassDefFoundError`` exception when your
Java runtime environment cannot locate a class file at runtime. When you
attempt to run application code that uses the {+driver-long+}, you must include
the appropriate driver JAR files on the classpath.

If you receive this error after adding the {+driver-short+} JAR files to
your classpath, check the following items in your environment:

- The JAR files exist in the locations specified by the classpath.
- The classpath syntax is correct.
- If you define the classpath in an environment variable, the Java runtime
environment uses that variable.
- If you use a dependency manager, it does not report any unresolvable conflicts.

.. tip::

This error contains the package and class name, which can help you identify
which driver JAR may be missing from your classpath. To locate the
driver JAR that the error refers to, check each of the entries in the
:ref:`API documentation <java-api-landing>`.


How do I prevent the "IllegalArgumentException: Invalid BSON field name" error?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down