SSM框架BUG集合

1.要注意路径问题,中间不是点,而是该目录下只有一个目录,所以没有分开

在这里插入图片描述
在这里插入图片描述

2.Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\WorkSpace\JAVA Development space\cgb2108III\springboot_ssm\target\classes\mybatis\mappers\UserMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘file [D:\WorkSpace\JAVA Development space\cgb2108III\springboot_ssm\target\classes\mybatis\mappers\UserMapper.xml]’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘Emp’. Cause: java.lang.ClassNotFoundException: Cannot find class: Emp

原因:映射文件里面接口的路径写错了
在这里插入图片描述

3.org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userserviceImpl’: Unsatisfied dependency expressed through field ‘userMapper’; nested exception is

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [D:\WorkSpace\JAVA Development space\cgb2108III\springboot_ssm\target\classes\com\jt\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\WorkSpace\JAVA Development space\cgb2108III\springboot_ssm\target\classes\mybatis\mappers\UserMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Parsing error was found in mapping #{}. Check syntax #{property|(expression), var1=value1, var2=value2, …}

SQL语法错误
在这里插入图片描述在这里插入图片描述

4.2022-01-04 15:49:35.312 ERROR 17288 — [nio-8090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘array’ not found. Available parameters are [ids, param1]] with root cause
未解决
在这里插入图片描述

5.前端正确,但是后端没有启动来接收

在这里插入图片描述

6.Description:Field axiosService in com.jt.controller.AxiosController required a bean of type ‘com.jt.service.AxiosService’ that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type ‘com.jt.service.AxiosService’ in your configuration.
Process finished with exit code 1
原因:在实现类当中,没有加上Service注解
在这里插入图片描述

7.Failed to load resource: net::ERR_CONNECTION_REFUSED createError.js?2d83:16 Uncaught (in promise) Error: Network Error

at createError (createError.js?2d83:16)
at XMLHttpRequest.handleError (xhr.js?b50d:84)

createError @ createError.js?2d83:16
handleError @ xhr.js?b50d:84
xhr.js?b50d:177 POST http://localhost:8091/user/login net::ERR_CONNECTION_REFUSED

原因:跨域问题,检查端口是否一致

在这里插入图片描述

8.Cannot resolve method ‘getTotal’ in ‘UserMapper’

原因:我的对象写错的位置,且参数导错了

9.Failed to load resource: the server responded with a status of 404 (Not Found)

可能是项目结构不对

10. org.junit.runners.model.InvalidTestClassError: Invalid test class ‘com.jt.redis.RedisTemplateTests’: 1. Method tesGetConnection() should be public

在springboot工程测试类当中一执行就报错是因为包导入错了
原因:包导错了

在这里插入图片描述

在这里插入图片描述

11.Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Sun Mar 13 09:27:43 CST 2022

There was an unexpected error (type=Method Not Allowed, status=405).
Request method ‘GET’ not supported
org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET’ not supported at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:201) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:421) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:367) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getHandlerInternal(RequestMappingHandlerMapping.java:449) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getHandlerInternal(RequestMappingHandlerMapping.java:67) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:393) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1234) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1016) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFil

在这里插入图片描述
在这里插入图片描述
1.解决方案:
1)Application启动类的位置不对

要将Application类放在最外侧,即包含所有子包spring-boot会自动加载启动类所在包下及其子包下的所有组件,下面举例说明。

在这总结确认了目前的三种错误案例

第一种,Application启动类直接放在了java包下面,这个在编译器就会报错
第二种,controller类跟Application启动类在同级包的不同包下边
第三种,启动类范围小于组件的位置范围
正确位置:在组件的同包或者组件的外层包内都可以,总之启动类的位置范围应大于或者等于组件所在位置。(原因就是上面那句不明觉厉的话)

2)在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题(暂未碰到,后期碰到后再补充):

当pom文件下的spring-boot-starter-paren版本高时使用:spring.mvc.view.prefix/spring.mvc.view.suffix
当pom文件下的spring-boot-starter-paren版本低时使用::spring.view.prefix/spring.view.suffix

3)控制器的URL路径书写问题:

@RequestMapping(“xxx”) ,实际访问的路径与”xxx”不符合

原文章地址:https://blog.csdn.net/Myuhua/article/details/84233554

10.org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET’ not supported

请求方式不匹配,检查一下

11.Caused by: java.lang.ClassNotFoundException: org.apache.flink.table.api.bridge.java.internal.BatchTableEnvironmentImpl

是因为项目下的jar包完整

12.java.sql.SQLException: 无法转换为内部表示

sql中的字段与数据库中的字段不一致,没有对应上

#13.异常:java.sql.SQLException: 无效的列类型: 1111
在mapper中没有指定相应的字段类型
如:where id = #{id,jdbcType=VARCHAR}

13解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题

找不到dao层的问题是因为我的mapper中的方法名多了个空格

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值