Community
Participate
Working Groups
Given the following class import javax.xml.bind.annotation.*; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class Root { public Inner inner; public class Inner { } } MOXy is currently throwing the following exception. The exception should not be thrown as the Inner class should never have been processed: Exception in thread "main" javax.xml.bind.JAXBException: Exception Description: The class forum8853855.part2.Root$Inner requires a zero argument constructor or a specified factory method. Note that non-static inner classes do not have zero argument constructors and are not supported. - with linked exception: [Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JAXBException Exception Description: The class forum8853855.part2.Root$Inner requires a zero argument constructor or a specified factory method. Note that non-static inner classes do not have zero argument constructors and are not supported.] at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:832) at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:143) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:142) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:129) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:93) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202) at javax.xml.bind.ContextFinder.find(ContextFinder.java:331) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) at forum8853855.part2.Demo.main(Demo.java:8) Caused by: Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JAXBException Exception Description: The class forum8853855.part2.Root$Inner requires a zero argument constructor or a specified factory method. Note that non-static inner classes do not have zero argument constructors and are not supported. at org.eclipse.persistence.exceptions.JAXBException.factoryMethodOrConstructorRequired(JAXBException.java:127) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:739) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:237) at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147) at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:829) ... 14 more
Created attachment 209583 [details] MOXy - Test Cases
Created attachment 209584 [details] MOXy - Fix Now in annotations processor only static inner classes are brought in by default. Non-static inner classes will still be processed in a mapped field/property is of that type.
Created attachment 209585 [details] MOXy - Test Cases
Fix checked into 2.3.3 at rev: 10692 Fix checked into trunk at rev: 10693 Code review by: Denise Smith Fix Details: Now in annotations processor only static inner classes are brought in by default. Non-static inner classes will still be processed in a mapped field/property is of that type.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink