Class initialization issues loading java.util.LogManager in Android Dalvik VM
- by Freddy B. Rose
I've done changes in an Android native library and installed a new system.img file but am now getting an unrelated Error on startup. I can get past it by swallowing the error but I wanted to know if anyone can explain what the issue is.
The Android implementation of Logger.java claims that it is Forcing the LogManager to be initialized since its class init code performs necessary one-time setup. But this forced initialization results in a NoClassDefFoundError. I'm thinking that it has something to do with the class not having been preloaded by Zygote yet but am not that familiar with the whole class loaders and VM business.
If anyone has some insight it would be greatly appreciated. Thanks.
I/Zygote ( 1253): Preloading classes...
D/skia ( 1253): ------ build_power_table 1.4
D/skia ( 1253): ------ build_power_table 0.714286
W/dalvikvm( 1253): Exception Ljava/lang/StackOverflowError; thrown during Ljava/util/logging/LogManager;.
W/dalvikvm( 1253): Exception Ljava/lang/NoClassDefFoundError; thrown during Ljava/security/Security;.
W/dalvikvm( 1253): Exception Ljava/lang/ExceptionInInitializerError; thrown during Landroid/net/http/HttpsConnection;.
E/Zygote ( 1253): Error preloading android.net.http.HttpsConnection.
E/Zygote ( 1253): java.lang.ExceptionInInitializerError
E/Zygote ( 1253): at java.lang.Class.classForName(Native Method)
E/Zygote ( 1253): at java.lang.Class.forName(Class.java:237)
E/Zygote ( 1253): at java.lang.Class.forName(Class.java:183)
E/Zygote ( 1253): at com.android.internal.os.ZygoteInit.preloadClasses(ZygoteInit.java:295)
E/Zygote ( 1253): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
E/Zygote ( 1253): at dalvik.system.NativeStart.main(Native Method)
E/Zygote ( 1253): Caused by: java.lang.ExceptionInInitializerError
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory$1.run(KeyManagerFactory.java:57)
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory$1.run(KeyManagerFactory.java:56)
E/Zygote ( 1253): at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
E/Zygote ( 1253): at java.security.AccessController.doPrivileged(AccessController.java:84)
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm(KeyManagerFactory.java:55)
E/Zygote ( 1253): at org.apache.harmony.xnet.provider.jsse.SSLParameters.(SSLParameters.java:142)
E/Zygote ( 1253): at org.apache.harmony.xnet.provider.jsse.SSLContextImpl.engineInit(SSLContextImpl.java:82)
E/Zygote ( 1253): at android.net.http.HttpsConnection.initializeEngine(HttpsConnection.java:101)
E/Zygote ( 1253): at android.net.http.HttpsConnection.(HttpsConnection.java:65)
E/Zygote ( 1253): ... 6 more
E/Zygote ( 1253): Caused by: java.lang.NoClassDefFoundError: java.util.logging.LogManager
E/Zygote ( 1253): at java.util.logging.Logger.initHandler(Logger.java:419)
E/Zygote ( 1253): at java.util.logging.Logger.log(Logger.java:1094)
E/Zygote ( 1253): at java.util.logging.Logger.warning(Logger.java:906)
E/Zygote ( 1253): at org.apache.harmony.luni.util.MsgHelp.loadBundle(MsgHelp.java:61)
E/Zygote ( 1253): at org.apache.harmony.luni.util.Msg.getString(Msg.java:60)
E/Zygote ( 1253): at java.io.BufferedInputStream.read(BufferedInputStream.java:316)
E/Zygote ( 1253): at java.io.FilterInputStream.read(FilterInputStream.java:138)
E/Zygote ( 1253): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:157)
E/Zygote ( 1253): at java.io.BufferedInputStream.read(BufferedInputStream.java:243)
E/Zygote ( 1253): at java.util.Properties.load(Properties.java:302)
E/Zygote ( 1253): at java.security.Security$1.run(Security.java:80)
E/Zygote ( 1253): at java.security.Security$1.run(Security.java:67)
E/Zygote ( 1253): at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
E/Zygote ( 1253): at java.security.AccessController.doPrivileged(AccessController.java:84)
E/Zygote ( 1253): at java.security.Security.(Security.java:66)
E/Zygote ( 1253): ... 15 more
W/dalvikvm( 1253): threadid=3: thread exiting with uncaught exception (group=0x2aac6170)