Json 具有泛型列表的JAXB marshall包装器对象

Json 具有泛型列表的JAXB marshall包装器对象,json,jaxb,jersey,moxy,Json,Jaxb,Jersey,Moxy,我正在使用jersey和MOXy实现一个Web服务。webservice将返回数据作为JSON结果。我想使用以下包装类包装一些集合: public class PaginationWrapper<T> { private List<T> data; //other fields private... public List<T> getData() { return data; } public voi

我正在使用jersey和MOXy实现一个Web服务。webservice将返回数据作为JSON结果。我想使用以下包装类包装一些集合:

public class PaginationWrapper<T>
{
   private List<T> data;
   //other fields
   private...

   public List<T> getData()
   {
      return data;
   }

   public void setData(List<T> data)
   {
      this.data = data;
   }

   //other getter and setter
}

替换泛型类型将修复该错误,但我不想为我拥有的每个数据对象创建包装器。因为我正在用jersey和moxy实现webservice,我无法访问编组本身。我需要一个基于注释的解决方案或其他将与jersey一起工作的解决方案

我用杰克逊代替莫西解决了这个问题。在没有任何配置的情况下,JSON编组是开箱即用的

javax.xml.bind.MarshalException
 - with linked exception:
[Exception [EclipseLink-25003] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b):         org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: An error occurred marshalling the object
Internal Exception: Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor for class packagereplaced.PaginationWrapper was not found in the project.  For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must     call a marshal method that accepts TypeMappingInfo as an input parameter.]