首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

REST web Services 的有关问题 “does not have a no-arg default constructor”

2012-08-22 
REST web Services 的问题 “does not have a no-arg default constructor”最近由于项目需要,研究后决定是R

REST web Services 的问题 “does not have a no-arg default constructor”

最近由于项目需要,研究后决定是REST web Services,在开发中遇到报错如下:

?

?

严重: Mapped exception to response: 500 (Internal Server Error)javax.ws.rs.WebApplicationException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptionscom.hnyxsm.entry.dataExchange.TDsInterface does not have a no-arg default constructor.this problem is related to the following location:at com.hnyxsm.entry.dataExchange.TDsInterface

?百度 谷歌无数,唯一一个对号的文章,图片不能显示。

?

万般无奈下,百度“ does not have a no-arg default constructor”的英文意思。问题终于解决了。

?

下面是原错误文件代码

?

?

package com.hnyxsm.entry.dataExchange;import javax.xml.bind.annotation.XmlRootElement;@XmlRootElement(name="TDsInterface")/** * 数据交换--接口管理 * @author SuperYuan */public class TDsInterface implements java.io.Serializable{/** *  */private static final long serialVersionUID = -1693894354995782167L;private int id;/* 主键 */private String title; /* 接口标题 */private String identificationCode;/* 识别码 */private String introdution; /* 功能简介 */private String sqlCode;/* sql语句 */private String reDateType;/* 返回数据类型 */private int reDateNumber;/* 返回数据条数 */public TDsInterface(int id, String title, String identificationCode,String introdution, String sqlCode, String reDateType,int reDateNumber) {this.id = id;this.title = title;this.identificationCode = identificationCode;this.introdution = introdution;this.sqlCode = sqlCode;this.reDateType = reDateType;this.reDateNumber = reDateNumber;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public String getIntrodution() {return introdution;}public void setIntrodution(String introdution) {this.introdution = introdution;}public String getIdentificationCode() {return identificationCode;}public void setIdentificationCode(String identificationCode) {this.identificationCode = identificationCode;}public String getSqlCode() {return sqlCode;}public void setSqlCode(String sqlCode) {this.sqlCode = sqlCode;}public String getReDateType() {return reDateType;}public void setReDateType(String reDateType) {this.reDateType = reDateType;}public int getReDateNumber() {return reDateNumber;}public void setReDateNumber(int reDateNumber) {this.reDateNumber = reDateNumber;}}

?

这是纠正后,能正确运行的代码:

?

package com.hnyxsm.entry.dataExchange;import javax.xml.bind.annotation.XmlRootElement;@XmlRootElement(name="TDsInterface")/** * 数据交换--接口管理 * @author SuperYuan */public class TDsInterface implements java.io.Serializable{/** *  */private static final long serialVersionUID = -1693894354995782167L;private int id;/* 主键 */private String title; /* 接口标题 */private String identificationCode;/* 识别码 */private String introdution; /* 功能简介 */private String sqlCode;/* sql语句 */private String reDateType;/* 返回数据类型 */private int reDateNumber;/* 返回数据条数 */public TDsInterface() {//关键就是这个,有了它,问题纠正super();}public TDsInterface(int id, String title, String identificationCode,String introdution, String sqlCode, String reDateType,int reDateNumber) {this.id = id;this.title = title;this.identificationCode = identificationCode;this.introdution = introdution;this.sqlCode = sqlCode;this.reDateType = reDateType;this.reDateNumber = reDateNumber;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public String getIntrodution() {return introdution;}public void setIntrodution(String introdution) {this.introdution = introdution;}public String getIdentificationCode() {return identificationCode;}public void setIdentificationCode(String identificationCode) {this.identificationCode = identificationCode;}public String getSqlCode() {return sqlCode;}public void setSqlCode(String sqlCode) {this.sqlCode = sqlCode;}public String getReDateType() {return reDateType;}public void setReDateType(String reDateType) {this.reDateType = reDateType;}public int getReDateNumber() {return reDateNumber;}public void setReDateNumber(int reDateNumber) {this.reDateNumber = reDateNumber;}}

热点排行