From 4247744c635d94884c8561c1b59fd400d50827db Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 9 Aug 2023 15:16:07 -0400 Subject: [PATCH 1/4] DOCSP-26293: FAQ entry for NoClasDefFoundError --- source/api-documentation.txt | 2 ++ source/faq.txt | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/source/api-documentation.txt b/source/api-documentation.txt index 1dd63b1ca..86d82da6b 100644 --- a/source/api-documentation.txt +++ b/source/api-documentation.txt @@ -1,3 +1,5 @@ +.. _java-api-landing: + ================= API Documentation ================= diff --git a/source/faq.txt b/source/faq.txt index 5e398482d..7f1bfd532 100644 --- a/source/faq.txt +++ b/source/faq.txt @@ -146,6 +146,31 @@ 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 this ``java.lang.NoClassDefFoundError`` exception or other +similar exception when your Java runtime environment is unable to 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 command that + runs your app uses that variable. +- If you use a dependency manager, it did 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 corresponds to the package and class name, check each of + the entries in the :ref:`API documentation `. + How do I prevent the "IllegalArgumentException: Invalid BSON field name" error? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 89c5bc1c1e8b1b2ba1eaf47beaa2d852fa36be0a Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 9 Aug 2023 15:34:02 -0400 Subject: [PATCH 2/4] grammar fixes --- source/faq.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source/faq.txt b/source/faq.txt index 7f1bfd532..a47863f8c 100644 --- a/source/faq.txt +++ b/source/faq.txt @@ -149,11 +149,10 @@ use as they are returned to the pool. How do I prevent the "java.lang.NoClassDefFoundError: com/mongodb/MongoClient" error? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You may encounter this ``java.lang.NoClassDefFoundError`` exception or other -similar exception when your Java runtime environment is unable to 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. +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: @@ -162,14 +161,14 @@ your classpath, check the following items in your environment: - The classpath syntax is correct. - If you define the classpath in an environment variable, the command that runs your app uses that variable. -- If you use a dependency manager, it did not report any unresolvable conflicts. +- 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 + 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 corresponds to the package and class name, check each of - the entries in the :ref:`API documentation `. + driver JAR that the error refers to, check each of the entries in the + :ref:`API documentation `. How do I prevent the "IllegalArgumentException: Invalid BSON field name" error? From 679844818e0a3e6f626a184cc634a69399a757ee Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 9 Aug 2023 15:42:19 -0400 Subject: [PATCH 3/4] build From 244ef4ee2adfddd2026ccb3770be5e380d46a0dd Mon Sep 17 00:00:00 2001 From: Chris Cho Date: Wed, 9 Aug 2023 15:49:43 -0400 Subject: [PATCH 4/4] clarification --- source/faq.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/faq.txt b/source/faq.txt index a47863f8c..f75c6b776 100644 --- a/source/faq.txt +++ b/source/faq.txt @@ -159,8 +159,8 @@ 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 command that - runs your app uses that variable. +- 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::