users@jersey.java.net

java.io.IOException: Error marshalling JAXB object of type "class com.mycompany.js.MyBean".

From: RajKal <rajkal23_at_yahoo.com>
Date: Wed, 5 Aug 2009 13:21:30 -0700 (PDT)

Hello Gurus,

Need help in resolving the below issue. Running on Weblogic 10.0 with Java 1.5 version.
Able to get proper response for simple Map and list but when i am using complex Map getting below error.

This is part of MyBean class.

    public Map<String, List<String>> getValueMapList() {
        return valueMapList;
    }

    public void setValueMapList(Map<String, List<String>> valueMapList) {
        this.valueMapList = valueMapList;
    }



java.io.IOException: Error marshalling JAXB object of type "class com.mycompany.js.MyBean".
    at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:145)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:254)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:578)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:502)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:493)
    Truncated. see log file for complete stacktrace
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
java.util.List is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.util.List
        at public java.util.Map com.mycompany.js.MyBean.getValueMapList()
        at com.mycompany.js.MyBean
java.util.List does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.util.List
        at public java.util.Map com.mycompany.js.MyBean.getValueMapList()
        at com.mycompany.js.MyBean

    at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:447)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:288)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1111)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
    Truncated. see log file for complete stacktrace
>

Thanks,
Raj