Jaro,
I've reproduced your error. Seems that
MappedSuperclasses from XML are not being initialized properly. Please enter a
bug. In the mean time, using MappedSuperclasses through annotations only should
solve your problem.
Cheers, Guy
On 20/04/2010 4:17 AM, Kuruc,
Jaro wrote:
Hi
I was able to strip down the project to the minimum to
demonstrate the problem with annotation processor. Please notice that if
annotations are used, metamodel is generated with no problems. As long as
orm.xml mappings are used, annotation processor is throwing this exception
(different to what I was posting before):
java.lang.RuntimeException: java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:366) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121) at
org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159) at
org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134) at
org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:809) at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:178) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:60) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by:
java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.metadata.ORMetadata.setEntityMappings(ORMetadata.java:481) at
org.eclipse.persistence.internal.jpa.metadata.ORMetadata$SimpleORMetadata.<init>(ORMetadata.java:608) at
org.eclipse.persistence.internal.jpa.metadata.ORMetadata.mergeSimpleObjects(ORMetadata.java:419) at
org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor.merge(MetadataAccessor.java:431) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.merge(ClassAccessor.java:776) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.merge(MappedSuperclassAccessor.java:394) at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.initPersistenceUnitClasses(XMLEntityMappings.java:522) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.initXMLEntityMappings(PersistenceUnit.java:392) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.<init>(PersistenceUnit.java:85) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:168) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63) at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:329) ...
24 more
Regards
Jaro
That surprises me greatly,
you sure you dropped it? If the eclipselink-orm is not found you should not go
through the file merging code.
Is your orm.xml file listed in your
persistence.xml?
Cheers, Guy
On 19/04/2010 12:01 PM, Kuruc,
Jaro wrote:
Hi
I am not using any annotations, just mappings in
META-INF/orm.xml. I also have META-INF/eclipselink-orm.xml which is
currently empty. Dropping it doesn't solve it. I have also tried to switch
from 2.0.1 to 2.1.0-M6, and it gives me similar
NullPointerException:
java.lang.RuntimeException:
java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:366) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121) at
org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159) at
org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134) at
org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:809) at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:178) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:60) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by:
java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.metadata.ORMetadata.mergeORObjectLists(ORMetadata.java:373) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.XMLAttributes.merge(XMLAttributes.java:252) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.merge(ClassAccessor.java:796) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.merge(MappedSuperclassAccessor.java:504) at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.initPersistenceUnitClasses(XMLEntityMappings.java:415) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.initXMLEntityMappings(PersistenceUnit.java:392) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.<init>(PersistenceUnit.java:85) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:168) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63) at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:329) ...
24 more
Regards
Jaro
Error appears to stem from the fact that you
have multiple xml mapping files. Do you have entities or classes defined
across multiple files?
Cheers, Guy
On 19/04/2010 11:26 AM,
Kuruc, Jaro wrote:
Hi
I've got other problem now. I am getting
NullPointerException from CanonicalModelProcessor (see below). Is there a
way to debug the annotation processor to see what might causing
it?
java.lang.RuntimeException:
java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:366) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139) at
org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121) at
org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159) at
org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134) at
org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:809) at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:178) at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301) at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:60) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:254) at
org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:173) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by:
java.lang.NullPointerException at
org.eclipse.persistence.internal.jpa.metadata.ORMetadata.mergeORObjectLists(ORMetadata.java:328) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.XMLAttributes.merge(XMLAttributes.java:252) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.merge(ClassAccessor.java:796) at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.merge(MappedSuperclassAccessor.java:394) at
org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings.initPersistenceUnitClasses(XMLEntityMappings.java:522) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.initXMLEntityMappings(PersistenceUnit.java:392) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnit.<init>(PersistenceUnit.java:85) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:168) at
org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63) at
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:329) ...
24 more
Regards
Jaro
Guy
Thanks for your answer. This is little but
unfortunate, as it prevents us from having a proper modular desing
where POJO domain objects and DAO interfaces are be defined in one
OSGi bundle, and another OSGi bundle with DAO implementations and mapping
files using specific ORM framework (EclipseLink in our
case).
However, I have found a workaround which is based on
having linked folder in Eclipse linking source folder from
Project A to Project B, so when Project B is built, classes from Project A
are built too and metamodel is generated for them. Classes from a linked
folder are built into separate output dir, so they are not mixed with
classes defined in source folder of Project B.
I can post a complete Eclipse project config if
anyone is interested.
Regards
Jaro
I
can't think of a good way to do this off hand. The model gen hooks into
the compiler using APT. Therefore, EntityA would never be a round element
when compiling ProjectB.
You may want to open a bug to have it
investigated further.
In the mean time, you'd have to turn on the
model gen for Project A with the same
persistence.xml.
Cheers, Guy
On 15/04/2010 12:41 PM,
Kuruc, Jaro wrote:
Hi
I am testing
out the JPA2 Metamodel generation in Eclipse and it looks like that
EclipseLink's Modelgen Processor is only supporting metamodel
generation for entities defined in the same Eclipse project in which
persistence.xml is defined.
Here's my
setup
Project A:
- defines
entity class EntityA
Project
B:
- depends on
Project A, hence having EntityA on classpath
- defines
entity class EntityB
- defines
persistence.xml
- annotation
processor is switched on
The result
is that EntityB_ is generated, but not EntityA_. I have tried both
annotation based mappings and mappings in orm.xml, but the result is the
same. Is there a way to tell EclipseLink Annotation Processor to
generate metadata for all classes on classpath? Maybe even restricting
it by specifying package to scan? Thanks.
Regards
Jaro Kuruc Java/SQL
Developer
Commerzbank AG Corporates &
Markets Market Risk
Office address: 30 Gresham Street, London
EC2V 7PG, United
Kingdom
Phone +44 (0)20 7475
8258
jaro.kuruc@xxxxxxxxxxxxxxx
http://www.commerzbank.com
Commerzbank Aktiengesellschaft, Frankfurt am Main Handelsregister/Commercial Register: Amtsgericht Frankfurt am
Main, HRB 32000 Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board:
Klaus-Peter Müller Vorstand/Board of Managing
Directors: Martin Blessing (Vorsitzender/Chairman), Frank Annuscheit, Markus Beumer,
Achim Kassow, Jochen Klösges, Michael
Reuther, Stefan Schmittmann, Ulrich Sieber, Eric Strutz
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
This e-mail is confidential and is intended only for the person to whom it is
addressed. It may be privileged and should not be read, copied or used by
anyone other than the intended recipient. If you are not that person, you are
not permitted to make use of the information and you are requested to notify
the sender immediately that you have received it and then destroy the copy in
your possession without disclosing its contents to any person.
Commerzbank AG may monitor outgoing and incoming e-mails. By replying to this
e-mail you consent to such monitoring. We believe, but do not warrant, that
this e-mail and any attachments are virus free, but you must take full
responsibility for virus checking.
This e-mail was sent either by Commerzbank AG, London Branch, or by Commerzbank
Corporates & Markets, a division of Commerzbank AG. Commerzbank AG is a
company incorporated in the Federal Republic of Germany and registered in
England (registered number FC008139, place of business 30 Gresham Street,
London EC2V 7PG) and is authorised by Bundesanstalt fuer
Finanzdienstleistungsaufsicht (BaFin) and authorised and subject to limited
regulation by the Financial Services Authority (FSA).
|