Community
Participate
Working Groups
For the following object model: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @XmlAccessorType(XmlAccessType.NONE) public class Foo { private Bar bar; public Bar getBar() { return bar; } public void setBar(Bar bar) { this.bar = bar; } } and: public class Bar { public Bar(String name) { } } When a JAXBContext is created on these classes the following exception is thrown: Exception in thread "main" javax.xml.bind.JAXBException: Exception Description: The class example.Bar 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 example.Bar 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.JAXBContextFactory.createContext(JAXBContextFactory.java:266) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:213) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:110) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:100) 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 forum119.Demo.main(Demo.java:8) Caused by: Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException Exception Description: The class example.Bar 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:122) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:651) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:228) at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:263) ... 12 more This exception should not be thrown since Bar should never be processed.
Created attachment 187041 [details] MOXy - Test Cases
Created attachment 187043 [details] MOXy - Test Cases
Created attachment 187044 [details] MOXy - Fix If the property is "transient" do not attempt to process its type.
Fix checked into trunk at rev: 8845 Code reviewed by: Matt MacIvor
This still appears to be broken in build: 2.3.0.v20110225-r9029 I am using externally defined xml mapping files instead of annotations, could it be that this is still broken for that case?
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink