title: javax.xml.bind.MarshalException - with linked exception: [javax.xml.bind.JAXBException: class ** nor any of its super class is known to this context
body: <p>I have a generic web service which is expecting a <code>WebServiceRequest</code> object. This object has a payload which is of type Object. Below is the type of my payload.</p>
  
  <pre><code>&lt;xs:complexType name="payload"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:any processContents="lax"&gt;&lt;/xs:any&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I created <code>JAXB</code> classes for the web service input and output types. So for payload, this the field that was generated.</p>
  
  <pre><code> @XmlAnyElement(lax = true)
   private Object any;
  </code></pre>
  
  <p>Below is the structure of my <code>JAXB</code> generated <code>WebServiceRequest</code> VO.</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "serviceRequest", namespace = "http://ws.test.svc.com/", propOrder = {
      "payload"
  })
  public class WebServiceRequest{
          @XmlElement
          private Payload payload;
  } 
  
  public class Payload{
   @XmlAnyElement(lax = true)
   private Object any;
  }
  </code></pre>
  
  <p>I have some custom POJOs which I need to populate and set as the payload. I annotated these POJOs using the following annotation</p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class AddressVO {
      @XmlElement
      private String pinCode;
      @XmlElement
      private String city;
  }
  </code></pre>
  
  <p>I populated the data for this POJO and tried to set as the payload of <code>WebServiceRequest</code>. But when I do that, I'm getting the below exception.</p>
  
  <pre><code>javax.xml.bind.MarshalException
   - with linked exception:
  [javax.xml.bind.JAXBException: class com.vo.test.AddressVO nor any of its super class is known to this context.
  </code></pre>
  
  <p>Could you please suggest some ways to overcome this? In one <a href="https://stackoverflow.com/questions/14057932/javax-xml-bind-jaxbexception-class-nor-any-of-its-super-class-is-known-to-t">link</a> it was mentioned to include <code>@XmlSeeAlso</code>, but i can't do that since my payload is very generic. Kindly help me in this regard.</p>