Community
Participate
Working Groups
Dynamic JAXB: Context Creation: testNewInstanceXSDImportError Error javax.xml.bind.JAXBException cannot be cast to org.eclipse.persistence.exceptions.JAXBException java.lang.ClassCastException: javax.xml.bind.JAXBException cannot be cast to org.eclipse.persistence.exceptions.JAXBException at org.eclipse.persistence.testing.jaxb.dynamic.DynamicJAXBContextCreationTestCases.testNewInstanceXSDImportError(DynamicJAXBContextCreationTestCases.java:234) Dynamic JAXB: Context Creation: testNewInstanceXSDExternalBindingError Failure Unexpected exception thrown. javax.xml.bind.JAXBException: Provider org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory could not be instantiated: javax.xml.bind.JAXBException - with linked exception: [Exception [EclipseLink-50078] (Eclipse Persistence Services - 2.4.0.v20110701-r9654): org.eclipse.persistence.exceptions.JAXBException Exception Description: Cannot process external bindings files (XJB). To use external bindings files, both XSD and XJB must be provided as javax.xml.transform.Sources.] - with linked exception: [javax.xml.bind.JAXBException - with linked exception: [Exception [EclipseLink-50078] (Eclipse Persistence Services - 2.4.0.v20110701-r9654): org.eclipse.persistence.exceptions.JAXBException Exception Description: Cannot process external bindings files (XJB). To use external bindings files, both XSD and XJB must be provided as javax.xml.transform.Sources.]]
Created attachment 199069 [details] Patch
Fixed. It seems that XJC throws slightly different exceptions in JDK1.7 vs JDK1.6 under the following error conditions: - using an external bindings file that is not a Source - non-Source schema imports another schema JDK 1.6: JAXBException --linked--> EclipseLinkException JDK 1.7: JAXBException --linked--> JAXBException --linked--> EclipseLinkException Changed test code to walk exception tree to look for an EclipseLink exception, instead of assuming it is one level deep.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink