Question

I use @XmlAccessorType(XmlAccessType.NONE) in package-info.java for my.package which means JAXB should care only about annotated elements. However, when I run my JUnit test with un/marshalling code for simple POJO MOXy just screams about every class (even from package without jaxb.properties or from other maven modules which are referenced in dependencies) in this manner:

Exception Description: The class other.maven.module.package.class 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.

I haven't encountered such issue with Metro (reference implementation, but it has other defects for my usage) and unfortunately I really can't modify every class in this way.

Was it helpful?

Solution

I have been able to verify this issue, the following bug has been entered to track this issue.

Issue summary:

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) {
    }

}

The EclipseLink MOXy JAXB implementation is processing the Bar class although it should not be, because it is not mapped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top