【问题标题】:Apache Shiro - ClassNotFoundExceptionApache Shiro - ClassNotFoundException
【发布时间】:2017-01-04 13:11:49
【问题描述】:
我很难在我的 Web 应用程序中使用 Apache Shiro(我使用的是 WildFly 10 和 Eclipse IDE):
- 我已经下载了 Shiro 的二进制发行版(
shiro-all from here)
- 我已经从here下载了slf4j API
- 我已将两个 jar 添加到类路径中
但是,当我尝试使用示例代码时,我得到 ClassNotFoundException 和 AuthenticationToken 类。有谁知道是什么原因造成的?
【问题讨论】:
标签:
java
eclipse
apache
classnotfoundexception
shiro
【解决方案1】:
强烈建议使用依赖管理工具(Maven、Gradle、Ivy 等)
shiro-all jar 不包含它的依赖项,因此您需要手动管理它们。
【解决方案2】:
尝试在你的类路径中添加 commons-logging.jar
如果你可以发布一些代码,例如 web.xml、shiro ini。
<listener-class> class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>