java.lang.ClassCastException: com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    ClassCastException when adding new POJO using javax.xml

    Stack Overflow | 6 months ago | Vlad Schnakovszki
    java.lang.ClassCastException: com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType

      at com.sun.tools.apt.mirror.declaration.AnnotationMirrorImpl.getAnnotationType()
    2. com.sun.tools
      InlineAnnotationReaderImpl.getAllMethodAnnotations
      1. com.sun.tools.apt.mirror.declaration.AnnotationMirrorImpl.getAnnotationType(AnnotationMirrorImpl.java:100)
      2. com.sun.tools.jxc.apt.InlineAnnotationReaderImpl.getAllAnnotations(InlineAnnotationReaderImpl.java:113)
      3. com.sun.tools.jxc.apt.InlineAnnotationReaderImpl.getAllMethodAnnotations(InlineAnnotationReaderImpl.java:102)
      4. com.sun.tools.jxc.apt.InlineAnnotationReaderImpl.getAllMethodAnnotations(InlineAnnotationReaderImpl.java:64)
      4 frames
    3. Old JAXB Runtime
      ElementPropertyInfoImpl$1.get
      1. com.sun.xml.bind.v2.model.impl.ClassInfoImpl.ensureNoAnnotation(ClassInfoImpl.java:1126)
      2. com.sun.xml.bind.v2.model.impl.ClassInfoImpl.collectGetterSetters(ClassInfoImpl.java:1039)
      3. com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findGetterSetterProperties(ClassInfoImpl.java:939)
      4. com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:310)
      5. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:243)
      6. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
      7. com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
      8. com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:92)
      9. com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:69)
      10. com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:74)
      11. com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:77)
      11 frames
    4. Java RT
      AbstractList$Itr.next
      1. java.util.AbstractList$Itr.next(AbstractList.java:358)
      1 frame
    5. Old JAXB Runtime
      ElementPropertyInfoImpl$1.get
      1. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:255)
      2. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
      3. com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
      4. com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:92)
      5. com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:69)
      6. com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:74)
      7. com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:77)
      7 frames
    6. Java RT
      AbstractList$Itr.next
      1. java.util.AbstractList$Itr.next(AbstractList.java:358)
      1 frame
    7. Old JAXB Runtime
      ModelBuilder.getTypeInfo
      1. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:255)
      2. com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
      3. com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
      4. com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:330)
      4 frames
    8. com.sun.tools
      SchemaGenerator$1.process
      1. com.sun.tools.xjc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:90)
      2. com.sun.tools.jxc.apt.SchemaGenerator$1.process(SchemaGenerator.java:115)
      2 frames
    9. com.sun.mirror
      AnnotationProcessors$CompositeAnnotationProcessor.process
      1. com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:84)
      1 frame
    10. com.sun.tools
      Main.process
      1. com.sun.tools.apt.comp.Apt.main(Apt.java:480)
      2. com.sun.tools.apt.main.AptJavaCompiler.compile(AptJavaCompiler.java:270)
      3. com.sun.tools.apt.main.Main.compile(Main.java:1127)
      4. com.sun.tools.apt.main.Main.compile(Main.java:989)
      5. com.sun.tools.apt.Main.processing(Main.java:113)
      6. com.sun.tools.apt.Main.process(Main.java:103)
      7. com.sun.tools.apt.Main.process(Main.java:85)
      7 frames
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    12. JAXB OSGI
      AptBasedTask.compile
      1. com.sun.tools.jxc.AptBasedTask$InternalAptAdapter.execute(AptBasedTask.java:97)
      2. com.sun.tools.jxc.AptBasedTask.compile(AptBasedTask.java:144)
      2 frames
    13. com.sun.tools
      SchemaGenMojo.execute
      1. com.sun.tools.jxc.maven2.SchemaGenAdapter.execute(SchemaGenAdapter.java:111)
      2. com.sun.tools.jxc.maven2.SchemaGenMojo.execute(SchemaGenMojo.java:161)
      2 frames
    14. Maven Plugin
      DefaultBuildPluginManager.executeMojo
      1. org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      1 frame
    15. Maven Core
      DefaultMaven.execute
      1. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      2. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      3. org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      4. org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      5. org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      6. org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      7. org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      8. org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      9. org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      9 frames
    16. M3 Interceptor
      MavenCli.main
      1. org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      2. org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      3. org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      3 frames
    17. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    18. Plexus
      Launcher.main
      1. org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      2. org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      3. org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      4. org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      5. org.codehaus.classworlds.Launcher.main(Launcher.java:47)
      5 frames
    19. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    20. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
      1 frame