java.lang.NoSuchMethodException: cn.pb.bean.Category.<init>()报错
代码如下:
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>()报错的更多相关文章
- Android 编程下 java.lang.NoClassDefFoundError: cn.jpush.android.api.JPushInterface 报错
使用了极光推送的 jar 包项目在从 SVN 中检出后,假设不又一次对 jar 包和 Bulid Path 进行配置就会抛出 java.lang.NoClassDefFoundError: cn.jp ...
- 日常报错记录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 ...
- Caused by: java.lang.InstantiationException: cn.at.bean.domain.ConstantInt
org.springframework.jdbc.UncategorizedSQLException: ConnectionCallback; uncategorized SQLException ...
- java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap报错解决
在使用 commons-beanutils-1.9.2.jarcommons-logging-1.1.1.jar 的时候报错 java.lang.NoClassDefFoundError: org/a ...
- java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory报错springmvc
转自:https://blog.csdn.net/qq_41879385/article/details/82892555 下面是错误信息:java.lang.ClassNotFoundExcepti ...
- (已解决)java.lang.NoSuchMethodException: com.kevenwu.pojo.User.<init>()
搭建ssm框架时报了如下错误,原因是: mybatis在初始化bean的时候需要无参构造器, 如果写了有参构造器,将会把无参构造器覆盖掉,加上一个无参构造器就可以了
- “java.lang.IllegalArgumentException: Failed to evaluate expression ‘ROLE_USER’”报错的解决
这个问题出现在Spring Security的相关配置中,找到原来的这一行: <security:intercept-url pattern="/**" access=&qu ...
- java.lang.NoSuchMethodException: .<init>()
严重: Servlet.service() for servlet [springmvc] in context with path [/SpringMvc-1] threw exception [R ...
- 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 ...
随机推荐
- freemark2pdf
freemarker+ITextRenderer 生成html转pdf 博客分类: ITextRenderer ITextRenderer 网上已经有比较多的例子 写这个 但是很多都是简单的 dem ...
- redmine 自己定义字段mysql表结构
redmine能够创建自己定义字段,我经经常使用它来满足不同的管理需求.如今来解读一下.看看这些自己定义字段是怎样存在mysql表中的. 表issues 用来存放issue的标准字段. mysql&g ...
- android开发系列之ContentObserver
在这篇博客里面我想要分享一下自己最近在项目里面遇到一个比较好的数据同步解决方案,首先让我们先来看看该方案的应用场景:我们在客户端本地利用数据库缓存了一些数据,当我们检测到数据库里面的数据发生变化的时候 ...
- OS开发之旅之App的生命周期【转载】
原文链接 http://www.360doc.com/content/15/0918/14/27799428_499912639.shtml 在iOS App中,入口函数并不在根目录下,而是在“Sup ...
- servletRequest 常用操作
package request; import java.io.IOException;import javax.servlet.ServletException;import javax.servl ...
- 从epoll构建muduo-12 多线程入场
mini-muduo版本号传送门 version 0.00 从epoll构建muduo-1 mini-muduo介绍 version 0.01 从epoll构建muduo-2 最简单的epoll ve ...
- php正则表达式匹配img中任意属性的方法
经常和图片打交道,不得不用到一些提取图片中scr.alt.title.等的属性,这里总结给大家一些常用的,感觉还不错,比较通用! PHP正则表达式匹配img中任意属性PHP 复制代码代码如下: < ...
- 安装部署zookeeper集群
实验说明: 三台虚拟机做zookeeper集群,集群个数最好是奇数个,原理详见zookeeper 详解 安装zookeeper 请确保jdk 已安装好,否则无法启动 三台虚拟机IP分别为:192. ...
- ASP.NET RemoteAttribute远程验证更新问题
create时使用remote特性没有任何问题, update时,问题就大了,验证唯一性时需要排除自身,如果使用这个特性将无法正确的验证. 改进思路:将自动生成的标签属性改为手写,,并在url上面加上 ...
- SPOJ SUBLEX - Lexicographical Substring Search 后缀自动机 / 后缀数组
SUBLEX - Lexicographical Substring Search Little Daniel loves to play with strings! He always finds ...