Skip to main content

@XmlJavaTypeAdapter -- ignored???

1 reply [Last post]
dtenev
Offline
Joined: 2006-03-07

I have a class that extends java.util.Date, which I am unable to map to XML. I've defined an XmlAdapter to map it to/from XMLGregorianCalendar, and annotated the class accordingly, but that doesn't work. The 2-nd apt round invariably produces the following:

[apt] Problem encountered during annotation processing;
[apt] see stacktrace below for more information.
[apt] java.lang.ClassCastException: com.sun.xml.bind.v2.model.impl.BuiltinLeafInfoImpl
[apt] at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getBaseClass(ClassInfoImpl.java:155)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:142)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
[apt] at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
[apt] at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
[apt] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:39)
[apt] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:42)
[apt] at java.util.AbstractList$Itr.next(Unknown Source)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
[apt] at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
[apt] at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
[apt] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:39)
[apt] at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:42)
[apt] at java.util.AbstractList$Itr.next(Unknown Source)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
[apt] at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
[apt] at com.sun.tools.xjc.api.impl.j2s.JavaCompilerImpl.bind(JavaCompilerImpl.java:54)
[apt] at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.completeModel(WebServiceAP.java:372)
[apt] at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:225)
[apt] at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
[apt] at com.sun.tools.apt.comp.Apt.main(Apt.java:450)
[apt] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:458)
[apt] at com.sun.tools.apt.main.Main.compile(Main.java:1075)
[apt] at com.sun.tools.apt.main.Main.compile(Main.java:938)
[apt] at com.sun.tools.apt.Main.processing(Main.java:95)
[apt] at com.sun.tools.apt.Main.process(Main.java:43)
[apt] at com.sun.tools.apt.Main.main(Main.java:34)

Is there a way to make the mapping work?

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

Can you file an issue on https://jaxb.dev.java.net/ with a test case?

Thanks for a bug report!