0

这个问题只是为了让其他人找到对 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

这些链接指向错误:

所以问题是:升级到 2.4.1 能解决这个问题吗?

我的回答是:升级到 EclipseLink 2.4.1 对我有用。

4

1 回答 1

0

以下是确保使用 Eclipselink 2.4.1 的 maven pom.xml 的摘录:

<repositories>
    <repository>
        <id>eclipselink</id>
        <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo/
        </url>
    </repository>
</repositories> 

与依赖:

    <!--  Eclipse Link persistence -->
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>2.4.1</version>
        <!-- <scope>provided</scope> uncomment if running inside a Java EE container -->
    </dependency>
于 2012-12-29T09:05:44.960 回答