java.lang.ExceptionInInitializerError

Spring JIRA | Yader Hernandez | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    This is a continuation of https://jira.springsource.org/browse/ANDROID-77 which lead me to this new issue. I am not using the maven way. How to reproduce: 1. download the jar from http://s3.amazonaws.com/dist.springframework.org/milestone/ANDROID/spring-android-1.0.0.RC1.zip 2. Only add core and rest jars to eclipse 3. add jars to build path 3. attempt to run application with any code change expecting: to see my application on the emulator actual: My emulator boots up and attempts to open my application. Emulator shows dialog to force close my application. Log cat output: 03-21 20:16:16.739: E/dalvikvm(304): Could not find class 'org.springframework.web.client.RestTemplate', referenced from method com.example.myapp.dao.MyDao.<init> 03-21 20:16:16.739: W/dalvikvm(304): VFY: unable to resolve new-instance 131 (Lorg/springframework/web/client/RestTemplate;) in Lcom/example.myapp.dao.MyDao; 03-21 20:16:16.739: D/dalvikvm(304): VFY: replacing opcode 0x22 at 0x0003 03-21 20:16:16.739: D/dalvikvm(304): VFY: dead code 0x0005-000a in Lcom/example.myapp.dao.MyDao;.<init> ()V 03-21 20:16:16.739: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.postForObject, referenced from method com.example.myapp.dao.MyDao.create 03-21 20:16:16.739: W/dalvikvm(304): VFY: unable to resolve virtual method 305: Lorg/springframework/web/client/RestTemplate;.postForObject (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object; 03-21 20:16:16.739: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0009 03-21 20:16:16.739: D/dalvikvm(304): VFY: dead code 0x000c-000f in Lcom/example.myapp.dao.MyDao;.create (Lcom/example/myapp/dto/MyAppDto;)Lcom/modernnerds/firesale/dto/FireSaleDto; 03-21 20:16:16.779: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.getForObject, referenced from method com.example.myapp.dao.MyDao.getNearByMyApps 03-21 20:16:16.779: W/dalvikvm(304): VFY: unable to resolve virtual method 304: Lorg/springframework/web/client/RestTemplate;.getForObject (Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object; 03-21 20:16:16.779: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0028 03-21 20:16:16.779: D/dalvikvm(304): VFY: dead code 0x002b-0032 in Lcom/example.myapp.dao.MyDao;.getNearByMyApps (Lcom/google/android/maps/GeoPoint;)Ljava/util/List; 03-21 20:16:16.779: W/dalvikvm(304): VFY: unable to find class referenced in signature (Lorg/springframework/web/client/RestTemplate;) 03-21 20:16:16.799: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.put, referenced from method com.example.myapp.dao.MyDao.update 03-21 20:16:16.799: W/dalvikvm(304): VFY: unable to resolve virtual method 306: Lorg/springframework/web/client/RestTemplate;.put (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)V 03-21 20:16:16.799: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0017 03-21 20:16:16.809: D/dalvikvm(304): VFY: dead code 0x001a-001a in Lcom/example.myapp.dao.MyDao;.update (Lcom/example/myapp/dto/MyAppDto;)V 03-21 20:16:16.809: W/dalvikvm(304): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/example/myapp/activity/GlobalActivity;.<clinit> 03-21 20:16:16.809: W/dalvikvm(304): Class init failed in newInstance call (Lcom/example/myapp/activity/HomeActivity;) 03-21 20:16:16.809: D/AndroidRuntime(304): Shutting down VM 03-21 20:16:16.809: W/dalvikvm(304): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 03-21 20:16:16.869: E/AndroidRuntime(304): FATAL EXCEPTION: main 03-21 20:16:16.869: E/AndroidRuntime(304): java.lang.ExceptionInInitializerError 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.Class.newInstanceImpl(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.Class.newInstance(Class.java:1429) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.os.Handler.dispatchMessage(Handler.java:99) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.os.Looper.loop(Looper.java:123) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.main(ActivityThread.java:4627) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.reflect.Method.invokeNative(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.reflect.Method.invoke(Method.java:521) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-21 20:16:16.869: E/AndroidRuntime(304): at dalvik.system.NativeStart.main(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): Caused by: java.lang.NoClassDefFoundError: org.springframework.web.client.RestTemplate 03-21 20:16:16.869: E/AndroidRuntime(304): at com.example.myapp.dao.MyDao.<init>(MyAppDao.java:15) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.example.myapp.activity.GlobalActivity.<clinit>(GlobalActivity.java:41) 03-21 20:16:16.869: E/AndroidRuntime(304): ... 15 more

    Spring JIRA | 5 years ago | Yader Hernandez
    java.lang.ExceptionInInitializerError
  2. 0

    This is a continuation of https://jira.springsource.org/browse/ANDROID-77 which lead me to this new issue. I am not using the maven way. How to reproduce: 1. download the jar from http://s3.amazonaws.com/dist.springframework.org/milestone/ANDROID/spring-android-1.0.0.RC1.zip 2. Only add core and rest jars to eclipse 3. add jars to build path 3. attempt to run application with any code change expecting: to see my application on the emulator actual: My emulator boots up and attempts to open my application. Emulator shows dialog to force close my application. Log cat output: 03-21 20:16:16.739: E/dalvikvm(304): Could not find class 'org.springframework.web.client.RestTemplate', referenced from method com.example.myapp.dao.MyDao.<init> 03-21 20:16:16.739: W/dalvikvm(304): VFY: unable to resolve new-instance 131 (Lorg/springframework/web/client/RestTemplate;) in Lcom/example.myapp.dao.MyDao; 03-21 20:16:16.739: D/dalvikvm(304): VFY: replacing opcode 0x22 at 0x0003 03-21 20:16:16.739: D/dalvikvm(304): VFY: dead code 0x0005-000a in Lcom/example.myapp.dao.MyDao;.<init> ()V 03-21 20:16:16.739: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.postForObject, referenced from method com.example.myapp.dao.MyDao.create 03-21 20:16:16.739: W/dalvikvm(304): VFY: unable to resolve virtual method 305: Lorg/springframework/web/client/RestTemplate;.postForObject (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object; 03-21 20:16:16.739: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0009 03-21 20:16:16.739: D/dalvikvm(304): VFY: dead code 0x000c-000f in Lcom/example.myapp.dao.MyDao;.create (Lcom/example/myapp/dto/MyAppDto;)Lcom/modernnerds/firesale/dto/FireSaleDto; 03-21 20:16:16.779: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.getForObject, referenced from method com.example.myapp.dao.MyDao.getNearByMyApps 03-21 20:16:16.779: W/dalvikvm(304): VFY: unable to resolve virtual method 304: Lorg/springframework/web/client/RestTemplate;.getForObject (Ljava/lang/String;Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object; 03-21 20:16:16.779: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0028 03-21 20:16:16.779: D/dalvikvm(304): VFY: dead code 0x002b-0032 in Lcom/example.myapp.dao.MyDao;.getNearByMyApps (Lcom/google/android/maps/GeoPoint;)Ljava/util/List; 03-21 20:16:16.779: W/dalvikvm(304): VFY: unable to find class referenced in signature (Lorg/springframework/web/client/RestTemplate;) 03-21 20:16:16.799: I/dalvikvm(304): Could not find method org.springframework.web.client.RestTemplate.put, referenced from method com.example.myapp.dao.MyDao.update 03-21 20:16:16.799: W/dalvikvm(304): VFY: unable to resolve virtual method 306: Lorg/springframework/web/client/RestTemplate;.put (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)V 03-21 20:16:16.799: D/dalvikvm(304): VFY: replacing opcode 0x6e at 0x0017 03-21 20:16:16.809: D/dalvikvm(304): VFY: dead code 0x001a-001a in Lcom/example.myapp.dao.MyDao;.update (Lcom/example/myapp/dto/MyAppDto;)V 03-21 20:16:16.809: W/dalvikvm(304): Exception Ljava/lang/NoClassDefFoundError; thrown during Lcom/example/myapp/activity/GlobalActivity;.<clinit> 03-21 20:16:16.809: W/dalvikvm(304): Class init failed in newInstance call (Lcom/example/myapp/activity/HomeActivity;) 03-21 20:16:16.809: D/AndroidRuntime(304): Shutting down VM 03-21 20:16:16.809: W/dalvikvm(304): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 03-21 20:16:16.869: E/AndroidRuntime(304): FATAL EXCEPTION: main 03-21 20:16:16.869: E/AndroidRuntime(304): java.lang.ExceptionInInitializerError 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.Class.newInstanceImpl(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.Class.newInstance(Class.java:1429) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.os.Handler.dispatchMessage(Handler.java:99) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.os.Looper.loop(Looper.java:123) 03-21 20:16:16.869: E/AndroidRuntime(304): at android.app.ActivityThread.main(ActivityThread.java:4627) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.reflect.Method.invokeNative(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): at java.lang.reflect.Method.invoke(Method.java:521) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-21 20:16:16.869: E/AndroidRuntime(304): at dalvik.system.NativeStart.main(Native Method) 03-21 20:16:16.869: E/AndroidRuntime(304): Caused by: java.lang.NoClassDefFoundError: org.springframework.web.client.RestTemplate 03-21 20:16:16.869: E/AndroidRuntime(304): at com.example.myapp.dao.MyDao.<init>(MyAppDao.java:15) 03-21 20:16:16.869: E/AndroidRuntime(304): at com.example.myapp.activity.GlobalActivity.<clinit>(GlobalActivity.java:41) 03-21 20:16:16.869: E/AndroidRuntime(304): ... 15 more

    Spring JIRA | 5 years ago | Yader Hernandez
    java.lang.ExceptionInInitializerError
  3. 0

    AndroidAnnotations with dagger compile error

    GitHub | 4 years ago | sinojelly
    java.lang.RuntimeException: Unable to create application com.example.test.app.TestApplication: java.lang.TypeNotPresentException: Type class java.lang.Object$$ModuleAdapter not present
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Class.forName android NoClassDefFoundError -> ClassNotFoundException

    Stack Overflow | 4 years ago | Diljeet
    java.lang.ClassNotFoundException: android.media.RemoteControlClient.MetadataEditor
  6. 0

    java.lang.NoClassDefFoundError: [generic] at dalvik.system.NativeStart.main(Native Method)

    Stack Overflow | 3 years ago | darkchaos
    java.lang.NoClassDefFoundError: [generic]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError

      org.springframework.web.client.RestTemplate

      at com.example.myapp.dao.MyDao.<init>()
    2. com.example.myapp
      GlobalActivity.<clinit>
      1. com.example.myapp.dao.MyDao.<init>(MyAppDao.java:15)
      2. com.example.myapp.activity.GlobalActivity.<clinit>(GlobalActivity.java:41)
      2 frames
    3. Java RT
      Class.newInstance
      1. java.lang.Class.newInstanceImpl(Native Method)
      2. java.lang.Class.newInstance(Class.java:1429)
      2 frames
    4. Android Platform
      ActivityThread.main
      1. android.app.Instrumentation.newActivity(Instrumentation.java:1021)
      2. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
      3. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
      4. android.app.ActivityThread.access$2300(ActivityThread.java:125)
      5. android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
      6. android.os.Handler.dispatchMessage(Handler.java:99)
      7. android.os.Looper.loop(Looper.java:123)
      8. android.app.ActivityThread.main(ActivityThread.java:4627)
      8 frames
    5. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invokeNative(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:521)
      2 frames
    6. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      2 frames
    7. Android Platform
      NativeStart.main
      1. dalvik.system.NativeStart.main(Native Method)
      1 frame