Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350516 - Deploying PU: NPE in EntityAccessor.discoverMappedSuperclassesAndInheritanceParents
Summary: Deploying PU: NPE in EntityAccessor.discoverMappedSuperclassesAndInheritanceP...
Status: RESOLVED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 401785 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-28 02:51 EDT by Oliver Vesper CLA
Modified: 2022-06-09 10:31 EDT (History)
6 users (show)

See Also:


Attachments
Submitted Changes (2.62 KB, patch)
2013-01-25 11:58 EST, Guy Pelletier CLA
guy.pelletier: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Vesper CLA 2011-06-28 02:51:54 EDT
Build Identifier: I20100608-0911

I migrated from EL 2.0.0.v20091127-r5931 to 2.3.0.v20110604-r9504 but the deployment of my PU fails with a NPE.

I've got an entity class which implements a couple of interfaces AND extends a NON-entity class. During the deploy of the persistence unit the method EntityAccessor.discoverMappedSuperclassesAndInheritanceParents is being called. The while-loop in line 241 operates upon an object named "parentClass" without making sure it's not null. The first while-loop-iteration works fine as the object is not null. But in line 286 the parentClass-variable is assigned a new value (which is null) and this causes the next iteration to fail with an NPE.

Reproducible: Always
Comment 1 Guy Pelletier CLA 2011-06-30 15:24:39 EDT
Can you post the stack trace?
Comment 2 Tom Ware CLA 2011-07-08 11:10:47 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 3 Guy Pelletier CLA 2011-09-27 13:04:29 EDT
This is a regression (from bug 253083)
Comment 4 Guy Pelletier CLA 2011-09-27 14:30:34 EDT
Well I thought it was a regression, but I am having a hard time to reproduce this exception. Beginning to wonder if it has already been fixed. Could you try to reproduce on the latest nigthly for 2.3.1?

http://www.eclipse.org/eclipselink/downloads/nightly.php
Comment 5 Guy Pelletier CLA 2011-09-28 14:35:54 EDT
I've been unable to reproduce this issue. If the error is still present using the latest 2.3.1 nightly please re-open the bug with your test model to reproduce.
Comment 6 eugeis CLA 2011-12-19 12:20:09 EST
The problem is not resolved in release 2.3.2

I have NPE in eclipselink 2.3.2 release, because the parentClass is null.
This is the statement "243:while (! parentClass.isObject()) {"

To reproduce, deploy a JPA Entity in this class hierarchy:

@Entity
public class ExampleEntity extends BaseEntityImpl {
...
}

@MappedSuperclass
public class BaseEntityImpl extends Base{
...
}

public class Base {
...
}



Workaround is to extend the Base class  explicit from Object, like  
public class Base extends Object {


Please fix like
"243:while (parentClass!=null && !parentClass.isObject()) {"




   [exec] java.lang.NullPointerException
   [exec]     at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.discoverMappedSuperclassesAndInheritanceParents(EntityAccessor.java:243)
   [exec]     at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.preProcess(EntityAccessor.java:526)
   [exec]     at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage1(MetadataProject.java:1608)
   [exec]     at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:531)
   [exec]     at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:526)
   [exec]     at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1337)
   [exec]     at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:208)
   [exec]     at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:393)
   [exec]     at weblogic.deployment.BasePersistenceUnitInfoImpl.initializeEntityManagerFactory(BasePersistenceUnitInfoImpl.java:386)
   [exec]     at weblogic.deployment.BasePersistenceUnitInfoImpl.<init>(BasePersistenceUnitInfoImpl.java:158)
   [exec]     at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:39)
   [exec]     at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:349)
   [exec]     at weblogic.deployment.EarPersistenceUnitRegistry.initialize(EarPersistenceUnitRegistry.java:72)
Comment 7 Ahmed Aadel CLA 2013-01-25 04:44:23 EST
I'm experiencing the same problem.  I'm using version 2.4.1.
 
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.discoverMappedSuperclassesAndInheritanceParents(EntityAccessor.java:244)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.preProcess(EntityAccessor.java:527)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage1(MetadataProject.java:1649)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:531)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:550)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1469)
Comment 8 Guy Pelletier CLA 2013-01-25 11:58:11 EST
Created attachment 226123 [details]
Submitted Changes

I've submitted this patch, however, note I was unable to reproduce the exception. Since we make a similar null check in other places, I decided to add it here as well. Note, however, the fact that the superclass is null before reaching Object 'could' lend itself to a configuration issue. The only time I could see a superclass being null is when we were unable to load the class. (We load and visit classes using ASM to be internal MetadataClass for processing)
Comment 9 Christoph Laeubrich CLA 2013-02-26 12:49:35 EST
*** Bug 401785 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Laeubrich CLA 2013-02-26 12:52:24 EST
I can confirm that this is still an issue in 2.4.1.v20121003-ad44345
Comment 11 Guy Pelletier CLA 2013-03-04 15:02:59 EST
The fix will be available in 2.4.2 +

In the mean time, if plausible, you can grab a nightly build from here:

http://www.eclipse.org/eclipselink/downloads/nightly.php
Comment 12 Eclipse Webmaster CLA 2022-06-09 10:31:40 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink