isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Compilation failing due to applying @javax.jdo.annotations.PersistenceCapable on an abstract class
Date Wed, 04 Feb 2015 09:22:22 GMT
Hi,

I just want to share a solution for a cryptic error I have faced today.

My Maven build failed with the following error:

...
DataNucleus : JDO Query - com.example.domain.model.MyEntity ->
com.example.domain.model.QMyEntity
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] App .......................................... SUCCESS [  0.098 s]
[INFO] App DOM ...................................... FAILURE [  1.500 s]
[INFO] App Fixtures ................................. SKIPPED
[INFO] App Integration Tests ........................ SKIPPED
[INFO] App Webapp ................................... SKIPPED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2.021 s
[INFO] Finished at: 2015-02-04T11:10:28+02:00
[INFO] Final Memory: 18M/301M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project app-dom: Fatal error compiling:
java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeSymbol
cannot be cast to javax.lang.model.element.TypeElement -> [Help 1]

Running "mvn compiile -X" produced:

Caused by: java.lang.ClassCastException:
com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to
javax.lang.model.element.TypeElement
at
org.datanucleus.jdo.query.JDOQueryProcessor.getExpressionInterfaceNameForType(JDOQueryProcessor.java:489)
at
org.datanucleus.jdo.query.JDOQueryProcessor.processClass(JDOQueryProcessor.java:254)
at
org.datanucleus.jdo.query.JDOQueryProcessor.process(JDOQueryProcessor.java:137)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)


In the web I've found that such errors occur when an annotation it applied
to a correct ElementType, e.g. java.lang.annotation.ElementType#TYPE, but
there are some extra modifiers which break the annotation compilation.
In my case it was the usage of javax.jdo.annotations.PersistenceCapable on
an *abstract* class.
It was good that DataNucleus prints the name of the entity it is going to
process. In my case: com.example.domain.model.MyEntity

I share this here for a reference if anyone else also hits this problem in
the future.


Martin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message