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 IllegalAnnotationExceptions
com.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;
	}
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值