shiro-core包引用的版本问题

时间:2023-02-07 19:55:07

在做shiro学习时,遇到这样的问题:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:154)
at org.apache.commons.beanutils.BeanUtilsBean.<init>(BeanUtilsBean.java:113)
at org.apache.shiro.config.ReflectionBuilder.<init>(ReflectionBuilder.java:126)
at org.apache.shiro.config.ReflectionBuilder.<init>(ReflectionBuilder.java:120)
at org.apache.shiro.config.IniSecurityManagerFactory.<init>(IniSecurityManagerFactory.java:64)
at org.apache.shiro.config.IniSecurityManagerFactory.<init>(IniSecurityManagerFactory.java:68)
at org.apache.shiro.config.IniSecurityManagerFactory.<init>(IniSecurityManagerFactory.java:73)
at com.chabansheng.shiro.HelloWorld.main(HelloWorld.java:15)
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:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more

检查后,是shiro-core包引用的版本问题,使用1.4.0会出现上面的问题,使用1.2.4就不会出现。