java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

Spring JIRA | Hendy Irawan | 4 years ago
  1. 0

    It happened for me when I used Spring Configuration annotation like this: {code} @Configuration @Import({ Config.class }) public class WebConfig extends WebMvcConfigurerAdapter { ... } {code} When I renamed Config.class to CoreConfig.class the error occurred when starting jetty. this happened because the CoreConfig.class was in a different sub module of my maven project, so jetty couldn't see it (as it resolves dependencies through mvn local repository). After calling 'mvn install' everything was fine again. This is a packaging problem on user's part. Some class is not on the classpath. as described in http://stackoverflow.com/questions/11823288/java-lang-arraystoreexception-sun-reflect-annotation-typenotpresentexceptionpro However the exception stacktrace does not mention what class cannot be found by Spring. So locating the culprit in a large project is very difficult and time consuming. Spring should pinpoint the affected class, who loads that class, so app developer can fix it. {noformat} Exception in thread "main" java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673) at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480) at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306) at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88) at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70) at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178) at java.lang.Class.getAnnotations(Class.java:3158) at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:159) at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:152) at org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:72) at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102) at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:72) at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:62) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:140) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:127) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:122) at org.springframework.context.annotation.AnnotationConfigApplicationContext.register(AnnotationConfigApplicationContext.java:151) at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:83) at org.springframework.issues.SampleApp.main(SampleApp.java:12) {noformat}

    Spring JIRA | 4 years ago | Hendy Irawan
    java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
  2. 0

    It happened for me when I used Spring Configuration annotation like this: {code} @Configuration @Import({ Config.class }) public class WebConfig extends WebMvcConfigurerAdapter { ... } {code} When I renamed Config.class to CoreConfig.class the error occurred when starting jetty. this happened because the CoreConfig.class was in a different sub module of my maven project, so jetty couldn't see it (as it resolves dependencies through mvn local repository). After calling 'mvn install' everything was fine again. This is a packaging problem on user's part. Some class is not on the classpath. as described in http://stackoverflow.com/questions/11823288/java-lang-arraystoreexception-sun-reflect-annotation-typenotpresentexceptionpro However the exception stacktrace does not mention what class cannot be found by Spring. So locating the culprit in a large project is very difficult and time consuming. Spring should pinpoint the affected class, who loads that class, so app developer can fix it. {noformat} Exception in thread "main" java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673) at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480) at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306) at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88) at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70) at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178) at java.lang.Class.getAnnotations(Class.java:3158) at org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:159) at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:152) at org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:72) at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102) at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:72) at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:62) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:140) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:127) at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:122) at org.springframework.context.annotation.AnnotationConfigApplicationContext.register(AnnotationConfigApplicationContext.java:151) at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:83) at org.springframework.issues.SampleApp.main(SampleApp.java:12) {noformat}

    Spring JIRA | 4 years ago | Hendy Irawan
    java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Cannot deploy simple project on Glassfish 3.1.2 and 4.0.0+

    GitHub | 2 years ago | vemod
    java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

  1. kjhdofjosvs 1 times, last 1 month ago
  2. sMaN 1 times, last 9 months ago
8 unregistered visitors
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.ArrayStoreException

    sun.reflect.annotation.TypeNotPresentExceptionProxy

    at sun.reflect.annotation.AnnotationParser.parseClassArray()
  2. Java RT
    Class.getAnnotations
    1. sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
    2. sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
    3. sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
    4. sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
    5. sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
    6. sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
    7. java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
    8. java.lang.Class.getAnnotations(Class.java:3158)
    8 frames
  3. Spring Core
    StandardAnnotationMetadata.isAnnotated
    1. org.springframework.core.annotation.AnnotatedElementUtils.doProcess(AnnotatedElementUtils.java:159)
    2. org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:152)
    3. org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:72)
    4. org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102)
    4 frames
  4. Spring Context
    AnnotationConfigApplicationContext.<init>
    1. org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:72)
    2. org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:62)
    3. org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:140)
    4. org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:127)
    5. org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:122)
    6. org.springframework.context.annotation.AnnotationConfigApplicationContext.register(AnnotationConfigApplicationContext.java:151)
    7. org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:83)
    7 frames
  5. org.springframework.issues
    SampleApp.main
    1. org.springframework.issues.SampleApp.main(SampleApp.java:12)
    1 frame