将方法公开为webservices时发出问题

时间:2011-11-14 12:54:49

标签: eclipse web-services cxf

这是我曾经作为webservices公开的代码

rs = st.executeQuery(individualqueries);
columnNames = new ArrayList<String>();
int numCols = rs.getMetaData().getColumnCount();
int j = 0;
for (j = 1; j <= numCols; j++) 
{
   columnNames.add(rs.getMetaData().getColumnName(j));
}

queryResult.fields.addAll(columnNames);
records = new ArrayList<List<String>>();
while (rs.next()) {

   List<String> fieldValues = new ArrayList<String>();
   int k = 0;
   for (k = 1; k <= numCols; k++) {

      fieldValues.add(rs.getString(k));
   }

   records.add(fieldValues);
}

当我尝试公开此消息时,我收到如下错误消息

Caused by: 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 private java.util.List 

1 个答案:

答案 0 :(得分:0)

将类型从List更改为ArrayList,这是List的具体实现。