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.
- is duplicated by
-
JAVA-291 Support Android platform
- Closed