cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Streit <mcs...@gmail.com>
Subject Re: Map<String, String> works but Map<String, Object> fails (CXF 2.6.2)
Date Tue, 01 Apr 2014 00:22:17 GMT
I am just taking a guess here, but Map<String, String> has elements which
are definable by XML Schema types as *xsd:String*, by default as these
represent typical *java.lang.String* types.  However with
*java.lang.Object*- what XML Schema type could that correspond to in
order to get
serialized/deserialized to by JAXB?

As stated, I am just guessing but that is the first thing that "jumps" out.
 I'm sure the CXF gurus (Daniel, Sergey, etc) would know more than me.

Mark




On Mon, Mar 31, 2014 at 8:11 PM, Al Eridani <al.eridani@gmail.com> wrote:

> I have a CXF 2.6.2 web service that works fine returning a List of custom
> result objects, each of which contains (among other things) a member of
> type Map<String, String>. Like this:
>
> public class Result {
>
>   ...
>
>   private Map<String, String> definition;
>
>   ...
>
>   public Map<String, String> getDefinition() {
>     return definition;
>   }
>   public void setDefinition(Map<String, String> definition) {
>     this.definition = definition;
>   }
>
>   ...
> }
>
> But, if I change the type of "definition" above to Map<String, Object> (and
> the accessors and other dependent code, of course) it fails with the
> exception below.
>
> Any ideas?
>
> javax.xml.bind.JAXBException: class java.util.HashMap nor any of its super
> class is known to this context.]
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:326)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
> at
>
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
> at
>
> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:554)
> at
>
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:236)
> at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:168)
> at
>
> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:110)
> at
>
> org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
> at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
> at
>
> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
> at
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
> at
>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at
>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
> at
>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
> at
>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)
> at
>
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:130)
> at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:221)
> at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:141)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:616)
> at
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:197)
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
> at
>
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)
> at
>
> com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:222)
> at
>
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
> at
>
> org.mypkg.servlet.BaseServletManager$CompressingFilterWrapper.doFilter(BaseServletManager.java:780)
> at
>
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
> at
>
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
> at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
> at org.mortbay.http.HttpServer.service(HttpServer.java:954)
> at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
> at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:987)
> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
> at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> Caused by: javax.xml.bind.JAXBException: class java.util.HashMap nor any of
> its super class is known to this context.
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:247)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:262)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> at
>
> com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:275)
> at
>
> com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:358)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
> at
>
> com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:69)
> at
>
> com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:172)
> at
>
> com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:159)
> at
>
> com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:358)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
> at
>
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:156)
> at
>
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:131)
> at
>
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:333)
> at
>
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:340)
> at
>
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:76)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
> ... 36 more
> Caused by: javax.xml.bind.JAXBException: class java.util.HashMap nor any of
> its super class is known to this context.
> at
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:588)
> at
>
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> ... 51 more
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message