NullPointerException you see is apparently caused by an error in the JAXB reference implementation. You can enter an error using the following link.
A similar exception does not occur when using EclipseLink JAXB (MOXy) as a JAXB provider.
Bypass
Instead, you can change a property of type String . A property of type Object in any case will not round, because unlike elements, attributes do not have any mechanisms to include information for input.
When I did this @XmlElement instead of an attribute, the schema was created without problems, so it should be relevant to this.
Java Model (Root)
An object is a valid property type when mapped to an XML element.
import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Root { private Object settingValue; public Object getSettingValue() { return settingValue; } public void setSettingValue(final Object settingValue) { this.settingValue = settingValue; } }
This is because the XML element may contain input information as an xsi:type attribute.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <root> <settingValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">123</settingValue> </root>
source share