title: JAXBContext.newInstance with generic class as input
body: <p>I have several JavaBeans like this (getter and setter omitted):</p>
  
  <pre><code>@Entity
  @XmlRootElement(name = "talent")
  public class Talent extends BaseObject implements Serializable {
  
      String gruppe;
      String art;
  }
  </code></pre>
  
  <p>and xml-files for them, all like </p>
  
  <pre><code>&lt;body&gt;
      &lt;item&gt;
          &lt;gruppe&gt;a&lt;/gruppe&gt;
          &lt;art&gt;b&lt;/art&gt;
      &lt;/item&gt;
      &lt;item&gt;
          &lt;gruppe&gt;a&lt;/gruppe&gt;
          &lt;art&gt;b&lt;/art&gt;
      &lt;/item&gt;
  &lt;/body&gt; 
  </code></pre>
  
  <p>now i want to read these xml files into my object. for the list I wrote a generic wrapper class as follows:</p>
  
  <pre><code>@XmlRootElement(name = "body")
  public class GenericWrapper&lt;E extends BaseObject&gt; {
  
      private ArrayList&lt;E&gt; talentListe;
  
      public ArrayList&lt;E&gt; getTalentListe() {
          return talentListe;
      }
  
      @XmlElement(name = "item")
      public void setTalentListe(ArrayList&lt;E&gt; talentListo) {
          this.talentListe = talentListo;
      }
  }
  </code></pre>
  
  <p>the problem occurs when i want to instantiate the JAXBContext:</p>
  
  <pre><code>JAXBContext context = JAXBContext.newInstance(GenericWrapper.class);
  Unmarshaller um = context.createUnmarshaller();
  GenericWrapper&lt;Talent&gt; gw = (GenericWrapper&lt;Talent&gt;) um.unmarshal(new FileReader(STORE_FILENAME));
  List&lt;Elementar&gt; list = gw.getTalentListe();
  </code></pre>
  
  <p>then the errormessage occurs:</p>
  
  <pre><code>Exception in thread "main" javax.xml.bind.UnmarshalException: Unable to create an instance of struktur.BaseObject
  </code></pre>
  
  <p>if I don't make my wrapperclass generic, everything works fine. I guess the problem is, when i want to get the JAXBContext.newInstance from my generic wrapper class, the generic part is not set, so it tries to use the most basic constructor from BaseObject which is abstract... how do I tell the method to generate the wrapper.class as a instance of GenericWrapper? that he uses the constructor of Talent, rather than my abstract BaseObject.</p>
  
  <p>PS: I'm sure i forgot a lot of needed information. plz coment, and i will provide everything needed. If a hole other aproach seems more reasonable, I'm willing to listen as well. but in general an answer to this question would be nice.</p>
  
  <p>EDIT: BaseObject is just an MappedSuperclass and struktur the package:</p>
  
  <pre><code>@MappedSuperclass
  @PrimaryKeyJoinColumn(name = "colConfig")
  public abstract class BaseObject {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      int id;
      private String name;
      @Column(columnDefinition = "TEXT")
      private String beschreibung;
  </code></pre>