我决定使用Shiro来保护我的web应用程序.我使用tomcat应用服务器,maven,hibernate和jsf.现在我尝试配置Shiro但遇到了一些问题.
这是我的文件:
--- ---的pom.xml
org.apache.shiro shiro-core 1.0.0-incubating org.apache.shiro shiro-web 1.0.0-incubating org.apache.shiro shiro-aspectj 1.0.0-incubating
--- ---的web.xml
Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.xhtml welcome.xhtml SecurityFilter org.apache.shiro.web.servlet.IniShiroFilter config [main] myrealm = com.misPartidos.web.MyRealm SecurityFilter /*
如果我部署到服务器,我收到此错误消息:
ERROR: Exception starting filter ShiroFilter java.lang.ClassNotFoundException: org.apache.shiro.web.servlet.IniShiroFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:581) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 30.07.2010 10:14:34 org.apache.catalina.core.StandardContext start ERROR: Error filterStart
我的错误在哪里?我是否还需要实现其他功能?谢谢你的帮助斯文
我想了一下这个问题.我认为关键是要设置领域.但是为了测试这个框架,我不想添加数据库或ldap.我需要一个简单的解决方案
我更改了web.xml,如下所示:
config [main] [users] tom = secret, admin paul = secret, user [roles] admin = * user = *
但错误仍然相同: - /
该问题与INI配置或您的Realm定义无关.这是因为org.apache.shiro.web.servlet.IniShiroFilter类不在类路径中.该类位于shiro-web-1.0.0-incubating.jar文件中(无需快照).确保您的POM依赖项正确列出它.
此外,在项目的Web模块中,运行"mvn install".然后查看'target'目录,你应该看到构建的.war文件.在命令行中,运行'jar tf my-war-file.war'.只要您在/ WEB-INF/lib中看到shiro-web-1.0.0-incubating.jar文件,就可以了.
干杯,
莱斯
(Apache Shiro团队)