Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] DynamicJAXBContext issue

Title: DynamicJAXBContext issue

Hello,
we tried to use DynamicJAXBContext in order to build dynamic entities from xsd schema but we get the exception:

Caused by: Exception [EclipseLink-50040] (Eclipse Persistence Services - 2.3.0.v20110415-r9234): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Error creating DynamicJAXBContext.
Internal Exception: java.lang.ArrayIndexOutOfBoundsException: 6
        at org.eclipse.persistence.exceptions.JAXBException.errorCreatingDynamicJAXBContext(JAXBException.java:582)
        ... 35 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
        at org.eclipse.persistence.dynamic.DynamicClassWriter.createEnum(DynamicClassWriter.java:303)
        at org.eclipse.persistence.dynamic.DynamicClassWriter.writeClass(DynamicClassWriter.java:172)
        at org.eclipse.persistence.dynamic.DynamicClassLoader.findClass(DynamicClassLoader.java:210)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:93)
        at org.eclipse.persistence.jaxb.JAXBEnumTypeConverter.convertClassNamesToClasses(JAXBEnumTypeConverter.java:66)
        at org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.convertClassNamesToClasses(AbstractDirectMapping.java:516)
        at org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1546)
        at org.eclipse.persistence.sessions.Project.convertClassNamesToClasses(Project.java:395)
        at org.eclipse.persistence.dynamic.DynamicTypeBuilder.loadDynamicProject(DynamicTypeBuilder.java:603)
        at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromMetadata(DynamicJAXBContext.java:219)
        ... 34 more

Libraries used:
- jdk 1.5.0_16
- EclipseLink 2.3.0.v20110415-r9234

We use DynamicJAXBContext in this way:

DynamicJAXBContext jaxbContext = DynamicJAXBContextFactory.createContextFromXSD(xsd.getInputStream(), null, null, null);

In class DynamicClassWriter source code, line 302, we found this check:

if (lastCount <= 5) {
  cv.visitInsn(ICONST[lastCount + 1]);
}

but ICONST is a 6 elements array.

At the moment we substituted <= with < and it works but we don't know if this is the right fix.

Thank you.
Daniele




Back to the top