Community
Participate
Working Groups
If an object mapped with an @XmlTransformation mapping does not have a 0-arg constructor the following exception is thrown. MOXy should treat @XmlTransformation in the same way that it does @XmlJavaTypeAdapter. Since the user is responsible for constructing the object themselves it should not matter what type of constructor it has. Exception in thread "main" javax.xml.bind.JAXBException: Exception Description: The class blog.transformation2.FOO 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.0.qualifier): org.eclipse.persistence.exceptions.JAXBException Exception Description: The class blog.transformation2.FOO 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:825) at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:136) 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 blog.transformation2.Demo.main(Demo.java:12) Caused by: Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException Exception Description: The class blog.transformation2.FOO 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:709) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:234) at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147) at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:822) ... 14 more
Created attachment 197533 [details] Proposed changes and test
Fix checked in to trunk, still needs to be checked in to 2.3 stream.
Checked in to 2.3 stream
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink