java.lang.IllegalStateException: Illegal access
项目场景:springboot项目启用热部署后出现问题问题描述:Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [mapper/]. The following stack trace
·
项目场景:
springboot项目启用热部署后出现问题
问题描述:
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [mapper/]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1385) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1038) ~[tomcat-embed-core-9.0.35.jar:9.0.35]
原因分析:
关键字不能加载[mapper/]。
springBoot 使用了spring-boot-devtools,热部署后加载mybatis映射文件找不到对应目录造成的;
解决方案:
方案一:禁用热加载
application.properties配置对应属性为false
spring.devtools.restart.enabled=false
方案二:
设application.properties
mybatis.mapperLocations=classpath*:mapper/*.xml
(使用classpath*:替换之前的classpath:来告诉spring查找所有classpath)
更多推荐
所有评论(0)