代码如下:

package cn.pb.bean;

import java.util.ArrayList;
import java.util.List; /**
* 分类的实体类
*/
public class Category {
private Integer cid;
private String cname;
private Integer pid; //父分类下子分类的集合
private List<Category> list = new ArrayList<Category>(); public Integer getCid() {
return cid;
} public void setCid(Integer cid) {
this.cid = cid;
} public String getCname() {
return cname;
} public void setCname(String cname) {
this.cname = cname;
} public Integer getPid() {
return pid;
} public void setPid(Integer pid) {
this.pid = pid;
} public List<Category> getList() {
return list;
} public void setList(List<Category> list) {
this.list = list;
} public Category(Integer cid, String cname, Integer pid, List<Category> list) {
this.cid = cid;
this.cname = cname;
this.pid = pid;
this.list = list;
} @Override
public String toString() {
return "Category{" +
"cid=" + cid +
", cname='" + cname + '\'' +
", pid=" + pid +
", list=" + list +
'}';
}
} 最后发现是我在代码最后写了个有参构造,重载了构造函数,而Mybatis在load进一个bean类时,需要无参构造从而导致了该错误, 解决方法,给代码加上午参构造即可!
public Category() {
super();
}
 

java.lang.NoSuchMethodException: cn.pb.bean.Category.<init>()报错的更多相关文章

  1. Android 编程下 java.lang.NoClassDefFoundError: cn.jpush.android.api.JPushInterface 报错

    使用了极光推送的 jar 包项目在从 SVN 中检出后,假设不又一次对 jar 包和 Bulid Path 进行配置就会抛出 java.lang.NoClassDefFoundError: cn.jp ...

  2. 日常报错记录2: MyBatis:DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.------------ Cause: java.lang.NoSuchMethodException: com.offcn.dao.ShopDao.<init>()

     直接上干货:  报错归纳1: DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4 ...

  3. Caused by: java.lang.InstantiationException: cn.at.bean.domain.ConstantInt

      org.springframework.jdbc.UncategorizedSQLException: ConnectionCallback; uncategorized SQLException ...

  4. java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap报错解决

    在使用 commons-beanutils-1.9.2.jarcommons-logging-1.1.1.jar 的时候报错 java.lang.NoClassDefFoundError: org/a ...

  5. java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory报错springmvc

    转自:https://blog.csdn.net/qq_41879385/article/details/82892555 下面是错误信息:java.lang.ClassNotFoundExcepti ...

  6. (已解决)java.lang.NoSuchMethodException: com.kevenwu.pojo.User.<init>()

    搭建ssm框架时报了如下错误,原因是: mybatis在初始化bean的时候需要无参构造器, 如果写了有参构造器,将会把无参构造器覆盖掉,加上一个无参构造器就可以了

  7. “java.lang.IllegalArgumentException: Failed to evaluate expression ‘ROLE_USER’”报错的解决

    这个问题出现在Spring Security的相关配置中,找到原来的这一行: <security:intercept-url pattern="/**" access=&qu ...

  8. java.lang.NoSuchMethodException: .<init>()

    严重: Servlet.service() for servlet [springmvc] in context with path [/SpringMvc-1] threw exception [R ...

  9. org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hs.model.StudentModel]: No default constructor found; nested exception is java.lang.NoSuchMethodException: c

    root cause org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [c ...

随机推荐

  1. less1.5中的减错误

    (@bodywidth)-@leftwidth即在第一个变量外加括号---正确 @bodywidth-@leftwidth即直接使用不加括号--------错误

  2. 命令行高效操作Git,看这篇就够了

    原文地址:http://blog.jboost.cn/2019/06/16/use-git.html 对于软件开发人员来说,git几乎是每天都需要接触的工具.但对于相处如此亲密的工作伙伴,你对它的了解 ...

  3. 基于jenkins,tekton等工具打造kubernetes devops平台

    本贴为目录贴,将不断更新 目录 1.Docker在centos下安装以及常见错误解决 2.使用kubernetes 官网工具kubeadm部署kubernetes(使用阿里云镜像) 3.无法访问gcr ...

  4. HTML5之Canvas绘图(二) ——应用篇之七巧板

    1.canvas绘制七巧板-- <!DOCTYPE html> <html> <head> <meta charset="UTF-8"&g ...

  5. ASP.NET数据库连接字符串的加密与解密

    ASP.NET web.config中,数据库连接字符串的加密与解密. 虽然不怎么新鲜,但相信还是有许多人不知道,好,不说废话,直接给方法:开始--->运行,输入cmd,接着输入以下内容 加密: ...

  6. 开源项目WebImageView载入图片

    项目地址:https://github.com/ZaBlanc/WebImageView 作者对载入图片,以及图片的内存缓存和磁盘缓存做了封装. 代码量不多.可是可以满足一般的载入图片. 先看下项目结 ...

  7. reduce python 的用法

    1.查看reduce 的用法 在python 命令查看 import functools help(functools) help(functools.reduce) 或者 from functool ...

  8. C ~ 指针零散记录

    2016.10.11 一个记录 void MB_float_u16(float f,uint16_t *a,uint16_t *b) { uint8_t *fp; ① uint8_t *ap; ② a ...

  9. [2018-12-18]ABP中的AsyncCrudAppService介绍

    前言 自从写完上次略长的<用ABP入门DDD>后,针对ABP框架的项目模板初始化,我写了个命令行工具Abp-CLI,其中子命令abplus init可以从github拉取项目模板以初始化项 ...

  10. map select reduce

    map: 针对每个element进行变换并返回整个修改后的map a.map do |item| a.upcase end a.map(&:upcase) 一样的效果, &:代表了it ...