这个问题只是为了让其他人找到对 EclipseLink 2.0 中的错误的引用,可以通过在此处升级到 2.4.1 来解决:
在为 EclipseLink 的持久实体引入通用超类后,出现以下错误:
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@40affc70
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.0.0.v20091127-r5931):
...
Caused by: java.lang.IndexOutOfBoundsException: Index: 12, Size: 12
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAsmFactory.resolveGenericTypes(MetadataAsmFactory.java:145)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.resolveGenericTypes(EntityAccessor.java:1332)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.discoverMappedSuperclassesAndInheritanceParents(EntityAccessor.java:316)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.preProcess(EntityAccessor.java:610)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.preProcess(EntityAccessor.java:593)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage1(MetadataProject.java:1296)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:460)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:390)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:940)
... 22 more
这些链接指向错误:
- http://www.eclipse.org/forums/index.php/t/367702/
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=372092
所以问题是:升级到 2.4.1 能解决这个问题吗?
我的回答是:升级到 EclipseLink 2.4.1 对我有用。