异常及解决办法

spring 及 springboot 异常

1.springboot测试类运行报错找不到测试类

报:Class not found com.cy.cj.common.cache.DefaultTest
image.png
原因 检查发现pom.xml文件中少添加了下面的依赖
image.png

<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-launcher</artifactId>
</dependency>

2.SringBoot测试类运行,控制台包 nosuchbean错误

image.png

原因: 没有对应bean的定义

image.png

3.goods项目页面数据呈现报错,只呈现表头,不呈现表数据

image.png
原因
image.png

4.Ajax get请求send(null)报错

Failed to load source:the server responded with a status 500()
image.png

mybatis异常及解决办法

1.永和项目门店信息修改页面数据呈现报错

exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.tedu.dao.DoorMapper.findById'.  It's likely that neither a Result Type nor a Result Map was specified.] with root cause

原因 检查发现mapper.xml文件的select标签少了resultType

<select id="findById" resultType="com.tedu.pojo.Door" >
        select * from tb_door where id =#{id}
    < /select>

2.永和项目门店信息修改 表单提交报错

错误: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists
image.png
原因 form表单里的action="doorUpdate"属性的值与controller里@RequestMapping("/updateDoor") 不同导致
image.png
### 3.添加订单时,跳转增加页面时报错 空指针错
错误
image.png
原因 缺少下面的注解
image.png


zhangsir
4 声望0 粉丝

下一篇 »
SpringBoot入门