openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitchell Arends (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-1965) ClassCastException when using JAXB and MetaModel annotation processor
Date Wed, 04 May 2011 17:50:03 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028858#comment-13028858
] 

Mitchell Arends commented on OPENJPA-1965:
------------------------------------------

I am experiencing this same exception when generating metamodel classes for OpenJPA 2.0.2.
Is this issue caused by having JAXB annotations in the same class file as JPA annotations
or is it caused by something else. Is there a known workaround for the issue? Thanks.

> ClassCastException when using JAXB and MetaModel annotation processor
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-1965
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1965
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 2.0.0, 2.1.0, 2.2.0
>            Reporter: Rick Curtis
>            Assignee: Rick Curtis
>             Fix For: 2.1.1, 2.2.0
>
>
> 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: com.sun.tools.javac.code.Symbol$PackageSymbol
cannot be cast to javax.lang.model.element.TypeElement
>    [javac]     at org.apache.openjpa.persistence.meta.AnnotationProcessor6.process(AnnotationProcessor6.java:207)
>    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625)
>    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554)
>    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699)
>    [javac]     at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)
>    [javac]     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
>    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:353)
>    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:279)
>    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:270)
>    [javac]     at com.sun.tools.javac.Main.compile(Main.java:69)
>    [javac]     at com.sun.tools.javac.Main.main(Main.java:54)
> ....
> -----
> Details on how to recreate :
> ....
> Hi,
> 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="com.sun.tools.xjc.XJC2Task" classpathref="toolingclasspath"/>
>        <xjc schema="my.xsd" destdir="${src.dir}"  package="domain.myweirdpackage"/>
>  </target>
> 3) put at least one Entity in domain package (parent of myweirdpackage)
> 4) run the MetaModel compiling step

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message