1. OpenJPA
  2. OPENJPA-1965

ClassCastException when using JAXB and MetaModel annotation processor


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.1.0, 2.2.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: tooling
    • Labels:


      This is a problem that was reported by Marc Logemann on the users mailing list. Details from the email exchange:

      So i see a lot of metamodel classes got generated but during this process i got this:

      [javac] An annotation processor threw an uncaught exception.
      [javac] Consult the following stack trace for details.
      [javac] java.lang.ClassCastException:$PackageSymbol cannot be cast to javax.lang.model.element.TypeElement
      [javac] at org.apache.openjpa.persistence.meta.AnnotationProcessor6.process(
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at
      [javac] at

      Details on how to recreate :

      this is nearly impossible because its not an Entity which makes the problem here. Its a package. I have no idea how to unit test that. Perhaps you can try creating
      a simple package with JAXB generated classes in it and try to reproduce:

      1) create a very simple XSD file
      2) run the JAXB compiler via ANT (then you should have some classes in myweirdpackage)

      <target name="JAXBCompiling" description="Compile main source tree java files">
      <taskdef name="xjc" classname="" classpathref="toolingclasspath"/>

      <xjc schema="my.xsd" destdir="$


      " package="domain.myweirdpackage"/>

      3) put at least one Entity in domain package (parent of myweirdpackage)
      4) run the MetaModel compiling step


        Rick Curtis created issue -
        Rick Curtis made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Rick Curtis made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Rick Curtis
            Rick Curtis
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: