Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.apache.ibatis.binding.BindingException: Mapper method 'com.example.demo.mapper.Attendentmapper.insert' attempted to return null from a method with a primitive return type (int).] with root cause
时间: 2023-06-28 22:10:12 浏览: 46
这个错误是因为你的 Mapper 中的 insert 方法返回了 null,但是它的返回类型是 int(原始数据类型),这是不允许的。你需要确保 insert 方法返回一个非 null 的 Integer 值,或者将其返回类型改为 Integer 对象类型,这样可以允许返回 null 值。你也可以检查一下你的 Mapper XML 文件,确保 insert 语句执行后返回了一个正确的值。
相关问题
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): zjc.mapper.UserMapper.findAllUser] with root cause
您好!根据您提供的信息,出现了一个异常:Request processing failed: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): zjc.mapper.UserMapper.findAllUser。这个异常通常是由于 MyBatis 配置文件中找不到指定的 SQL 语句引起的。请确保在配置文件中存在名为 "zjc.mapper.UserMapper.findAllUser" 的有效 SQL 语句。
您可以检查以下几个方面来解决这个问题:
1. 确保在 MyBatis 配置文件中正确配置了 UserMapper 接口的映射。可以检查是否存在一个名为 "zjc.mapper.UserMapper.xml" 的文件,并且其中包含了正确的 SQL 映射配置。
2. 确保在 UserMapper.xml 文件中存在一个名为 "findAllUser" 的 SQL 语句。可以检查是否存在类似以下的配置:
```xml
<select id="findAllUser" resultType="User">
SELECT * FROM users
</select>
```
这里的 "User" 是您的实体类,根据需要可能会有所不同。
3. 确保 UserMapper 接口中存在一个名为 "findAllUser" 的方法,并且与 XML 文件中的配置一致。可以检查是否存在类似以下的方法定义:
```java
List<User> findAllUser();
```
这里的 "User" 是您的实体类,方法名和返回类型需要与 XML 文件中的配置一致。
希望以上信息对您有所帮助!如果您有任何其他问题,请随时提问。
Servlet.service() for servlet [dispatcherServlet] in context with path [/] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zo.unified.access.service.auth.OauthService.getThirdLoginUrl] with root cause
这个异常通常是因为MyBatis找不到对应的SQL语句导致的。具体来说,你的代码中可能存在以下问题之一:
1. 你的SQL语句没有正确的配置,比如XML文件中没有正确的定义或者没有将SQL语句与Mapper接口方法正确的绑定。
2. 你的Mapper接口方法名与XML文件中定义的SQL语句id不一致,导致找不到对应的SQL语句。
3. 你的Mapper接口方法没有正确的注解,或者注解中的参数与SQL语句中的参数不匹配。
你可以检查一下以上几个方面,看看是否存在问题。另外,如果你能提供更多的代码细节和报错信息,我可以帮你更好地定位问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![jar](https://img-home.csdnimg.cn/images/20210720083455.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)