Skip to main content

IllegalAnnotationsException: "type XY that doesnt have an XmlID property

2 replies [Last post]
destermann
Offline
Joined: 2005-11-11

Is issue #45 (XmlID not being found) really solved?
Using release jaxb-ri-20051201, i get a similar exception at runtime (when instantiating the JAXBContext):

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:
XmlIDREF property is referencing a type "mytest.Pattern" that doesnt have an XmlID property.
this problem is related to the following location:
at mytest.Pattern mytest.PatternRef.ref
at mytest.PatternRef

at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:330)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:198)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
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:585)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:561)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:508)

My code was initially generated by xjc - i then manually...
- moved the id attribute to the base class (Referencable)
- changed the ref attribute type from Object to Pattern

public class Referencable {
@XmlAttribute
@XmlID
String id;
}
public class Pattern extends Referencable {
/* more fields */
}
public class PatternRef {
@XmlAttribute
@XmlIDREF
Pattern ref;
}

Best regards,
Daniel

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

This seems like a bug. Working on it...

kohsuke
Offline
Joined: 2003-06-09

The issue is different from #45.
I'm about to commit a fix.