错误描述:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:179) at com.lyy.springboot.SpringBoot06DataMybatisApplication.main(SpringBoot06DataMybatisApplication.java:12) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more
出现错误的原因是——缺少 commons-logging.jar 包,只需在maven中央仓库中搜索下载commons-logging.jar,之后再导入你的java工程中即可!
仓库地址:https://mvnrepository.com/artifact/commons-logging/commons-logging
或者下载jar:http://commons.apache.org/proper/commons-logging/download_logging.cgi