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

Support Android platform

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.9.0
    • Affects Version/s: 2.3, 2.4, 2.5
    • Component/s: API
    • Environment:
      Eclipse Helios Service Release 1, mongodb 1.6.5, Android SDK version 7/release 2, Windows XP SP3, Windows Vista SP2

      Hello to everybody,

      I am facing the following problem:

      I am trying to use the java driver within the android SDK and it gets crashed when use it as a precompiled jar (ver. 2.3, ver.2.4, ver.2.5)
      whether I use it as-is or after converting it to dex format with dx.

      Here is the stack trace:

      03-11 22:38:17.320: INFO/dalvikvm(230): Could not find method java.lang.management.ManagementFactory.getRuntimeMXBean, referenced from method org.bson.types.ObjectId.<clinit>
      03-11 22:38:17.320: WARN/dalvikvm(230): VFY: unable to resolve static method 1537: Ljava/lang/management/ManagementFactory;.getRuntimeMXBean ()Ljava/lang/management/RuntimeMXBean;
      03-11 22:38:17.320: DEBUG/dalvikvm(230): VFY: replacing opcode 0x71 at 0x006c
      03-11 22:38:17.320: DEBUG/dalvikvm(230): Making a copy of Lorg/bson/types/ObjectId;.<clinit> code (529 bytes)
      03-11 22:38:17.410: WARN/dalvikvm(230): Exception Ljava/lang/RuntimeException; thrown during Lorg/bson/types/ObjectId;.<clinit>
      03-11 22:38:17.580: WARN/dalvikvm(230): Exception Ljava/lang/ExceptionInInitializerError; thrown during Lcom/mongodb/Bytes;.<clinit>

      I have tried to use the source code in the project but depends on the MBeanServer component and the java.lang.management package , hence it can't be compiled for dalvik because of their absence. The exception is thrown from the file ObjectId.class where
      the MBeanServer is called.

      I read in jira.mongodb.org/browse/JAVA-170 that the compilation of java.lang.management is optional but I couldn't figure it out.

      Any help is greatly apreciated.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            akxs14 Angelos Kapsimanis
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: