Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2026

Use of MongoCredential throws unhandled exceptions on Android

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.13.3, 3.1.0
    • Component/s: Authentication
    • Environment:
      Android

      I am maintaining an open source project which is an android front-end client for Mongo DB (https://github.com/grennis/MongoExplorer/). So, hardcoding credentials is not an issue here. The user types in their credentials and database connection information.

      I have been using deprecated authentication mechanism MongoDatabase.authenticate(...) and it does work in most scenarios, however, it seems to no longer work (with MongoLab at least). So, I'm trying to use MongoCredential to authenticate.

      However, it does not seem to work on Android.

      With driver version 3.1.x I get various exceptions,
      Could not find method java.lang.management.ManagementFactory.getRuntimeMXBean, referenced from method org.bson.types.ObjectId.createProcessIdentifier
      VFY: unable to resolve static method 24444: Ljava/lang/management/ManagementFactory;.getRuntimeMXBean ()Ljava/lang/management/RuntimeMXBean;
      And then followed by unhandled exception - java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory

      With driver version 2.13.x I get exception similiar exceptions ultimately resulting in:
      java.lang.VerifyError: com/mongodb/DBPort$PlainAuthenticator

            Assignee:
            Unassigned Unassigned
            Reporter:
            grennis Greg Ennis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: