Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.0
-
Android
Description
(Note that it is possible to work around this issue by modifying the policy and added internet permission to the Android manifest xml file.)
Stacktrace:
07-15 14:38:37.627 1243-1243/com.torointl.log4j2xtest W/dalvikvm﹕ Exception Landroid/os/NetworkOnMainThreadException; thrown while initializing Lcom/torointl/log4j2xtest/MyActivity; 07-15 14:38:37.627 1243-1243/com.torointl.log4j2xtest W/dalvikvm﹕ Class init failed in newInstance call (Lcom/torointl/log4j2xtest/MyActivity;) 07-15 14:38:37.627 1243-1243/com.torointl.log4j2xtest W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4d72b20) 07-15 14:38:37.639 1243-1243/com.torointl.log4j2xtest E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.torointl.log4j2xtest, PID: 1243 java.lang.ExceptionInInitializerError at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1208) at android.app.Instrumentation.newActivity(Instrumentation.java:1061) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145) at java.net.InetAddress.lookupHostByName(InetAddress.java:385) at java.net.InetAddress.getLocalHost(InetAddress.java:365) at org.apache.logging.log4j.core.util.NetUtils.getLocalHostname(NetUtils.java:47) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:356) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:416) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:146) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:75) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37) at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:473) at com.torointl.log4j2xtest.MyActivity.<clinit>(MyActivity.java:14) at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1208) at android.app.Instrumentation.newActivity(Instrumentation.java:1061) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)
Attachments
Issue Links
- is related to
-
LOG4J2-703 Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup
- Resolved