gpt4 book ai didi

java - ClassNotFoundException : org. apache.shiro.web.env.EnvironmentLoaderListener

转载 作者:行者123 更新时间:2023-11-30 03:20:14 31 4
gpt4 key购买 nike

我有基于 Jersey 和 Shiro 安全性的简单 RESTful 服务。
但当我尝试部署时,一切都崩溃了。

web.xml

<servlet>
<servlet-name>Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>alexiuscrow.ws</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>

Gradle 依赖项:

dependencies {
compile 'org.glassfish.jersey.core:jersey-server:2.19'
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.19'
compile 'org.apache.shiro:shiro-core:1.2.3'
compile 'org.apache.shiro:shiro-web:1.2.3'
}

输出:

18-Jul-2015 21:28:10.775 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class org.apache.shiro.web.env.EnvironmentLoaderListener
java.lang.ClassNotFoundException: org.apache.shiro.web.env.EnvironmentLoaderListener
//...

怎么了?为什么无法部署?

最佳答案

您使用 Shiro 1.2.4 吗?并且您已包含 slf4j-api-1.7.12 ?(Shiro 需要 slf4j)

实际问题来自slf4j-api-1.7.12它说:

Uncaught exception from servlet
java.lang.ExceptionInInitializerError
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:149)
...
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createSecurityManager")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:382)

我的解决方案

我把slf4j-api-1.7.7

关于java - ClassNotFoundException : org. apache.shiro.web.env.EnvironmentLoaderListener,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31494455/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com