Java.lang.NoSuchMethodException ()

Source: Internet
Author: User

Today using the MyBatis connection database times out of the java.lang.NoSuchMethodException error, the error message is as follows,


Error tip, the error location is the player's Bean class instantiation is wrong, the player code is as follows

public class Player {private int pid;
	Private String pname;
	private String position;
	private int CID;
	Private Club club;//a many-to-many relationship public int getpid () {return PID;
	public void setpid (int pid) {this.pid = pid;
	Public String Getpname () {return pname;
	} public void Setpname (String pname) {this.pname = PName;
	Public String getPosition () {return position;
	} public void SetPosition (String position) {this.position = position;
	public int getcid () {return CID;
	public void Setcid (int cid) {this.cid = CID;
	Public Club Getclub () {return club;
	public void Setclub (club club) {this.club = Club;
		public Player (int pid, string pname, string position, int CID, club club) {super ();
		This.pid = pid;
		This.pname = PName;
		This.position = position;
		This.cid = CID;
	This.club = Club; @Override public String toString () {return "Player [pid= + pid +", pname= "+ PName +", position= "+ Position +"
	, cid= "+ CID +"]; }
	
} 
The last thing I found was that I wrote a parametric construct at the end of the code, overloaded the constructor, and MyBatis, when loading into a bean class, required a parameterless construct to cause the error.

Solution, to the code plus the morning parameter construction can be.

Public Player () {
		super ();
	}







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.