Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347470

Summary: Error thrown when object mapped with @XmlTransformation does not have a 0-arg constructor
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed changes and test none

Description Blaise Doughan CLA 2011-05-27 11:18:01 EDT
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
Comment 1 Denise Smith CLA 2011-06-07 14:56:08 EDT
Created attachment 197533 [details]
Proposed changes and test
Comment 2 Denise Smith CLA 2011-06-07 15:42:14 EDT
Fix checked in to trunk, still needs to be checked in to 2.3 stream.
Comment 3 Denise Smith CLA 2011-06-24 15:08:45 EDT
Checked in to 2.3 stream
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:34:08 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink