Return-Path: X-Original-To: apmail-isis-users-archive@www.apache.org Delivered-To: apmail-isis-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E53110796 for ; Wed, 4 Feb 2015 09:23:06 +0000 (UTC) Received: (qmail 69559 invoked by uid 500); 4 Feb 2015 09:23:04 -0000 Delivered-To: apmail-isis-users-archive@isis.apache.org Received: (qmail 69526 invoked by uid 500); 4 Feb 2015 09:23:04 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 69515 invoked by uid 99); 4 Feb 2015 09:23:04 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2015 09:23:04 +0000 Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id B08A51A0118 for ; Wed, 4 Feb 2015 09:23:03 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id y19so554378wgg.2 for ; Wed, 04 Feb 2015 01:23:02 -0800 (PST) X-Received: by 10.194.94.164 with SMTP id dd4mr65969363wjb.56.1423041782430; Wed, 04 Feb 2015 01:23:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.185.198 with HTTP; Wed, 4 Feb 2015 01:22:22 -0800 (PST) From: Martin Grigorov Date: Wed, 4 Feb 2015 11:22:22 +0200 Message-ID: Subject: Compilation failing due to applying @javax.jdo.annotations.PersistenceCapable on an abstract class To: users Content-Type: multipart/alternative; boundary=047d7bb04102f14444050e3fbbb9 --047d7bb04102f14444050e3fbbb9 Content-Type: text/plain; charset=UTF-8 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 --047d7bb04102f14444050e3fbbb9--