spring配置文件报错,求解
C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\bin\catalina.bat run
[2019-07-16 12:18:02,820] Artifact shiro-web:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro"
Using CATALINA_HOME: "C:\Users\Administrator\Downloads\apache-tomcat-7.0.79"
Using CATALINA_TMPDIR: "C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_161"
Using CLASSPATH: "C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\bin\bootstrap.jar;C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\bin\tomcat-juli.jar"
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/7.0.79
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Jun 26 2017 16:25:20 UTC
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 7.0.79.0
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 8.1
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 6.3
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jdk1.8.0_161\jre
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_161-b12
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: C:\Users\Administrator\Downloads\apache-tomcat-7.0.79
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro\conf\logging.properties
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote=
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.port=1099
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.password.file=C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro\jmxremote.password
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.access.file=C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro\jmxremote.access
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\endorsed
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=C:\Users\Administrator\.IntelliJIdea2018.3\system\tomcat\Unnamed_shiro
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=C:\Users\Administrator\Downloads\apache-tomcat-7.0.79
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\temp
七月 16, 2019 12:18:03 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.2.21 using APR version 1.6.5.
七月 16, 2019 12:18:03 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
七月 16, 2019 12:18:03 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.1.1a 20 Nov 2018)
七月 16, 2019 12:18:03 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
七月 16, 2019 12:18:03 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 449 ms
七月 16, 2019 12:18:03 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
七月 16, 2019 12:18:03 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
七月 16, 2019 12:18:03 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
七月 16, 2019 12:18:03 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
七月 16, 2019 12:18:03 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 63 ms
Connected to server
[2019-07-16 12:18:03,870] Artifact shiro-web:war exploded: Artifact is being deployed, please wait...
七月 16, 2019 12:18:04 下午 org.apache.catalina.deploy.WebXml setVersion
警告: Unknown version string [4.0]. Default version will be used.
七月 16, 2019 12:18:04 下午 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
七月 16, 2019 12:18:04 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started
七月 16, 2019 12:18:04 下午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
信息: Refreshing Root WebApplicationContext: startup date [Tue Jul 16 12:18:04 CST 2019]; root of context hierarchy
七月 16, 2019 12:18:05 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/spring-conf.xml]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
七月 16, 2019 12:18:05 下午 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
信息: Bean 'credentialsMatcher' of type [org.apache.shiro.authc.credential.HashedCredentialsMatcher] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
七月 16, 2019 12:18:05 下午 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
信息: Bean 'realm' of type [com.immoc.realm.Realm] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
七月 16, 2019 12:18:05 下午 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
信息: Bean 'securityManager' of type [org.apache.shiro.web.mgt.DefaultWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
七月 16, 2019 12:18:05 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization completed in 766 ms
七月 16, 2019 12:18:05 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more Filters failed to start. Full details will be found in the appropriate container log file
七月 16, 2019 12:18:05 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [] startup failed due to previous errors
七月 16, 2019 12:18:05 下午 org.springframework.web.context.support.XmlWebApplicationContext doClose
信息: Closing Root WebApplicationContext: startup date [Tue Jul 16 12:18:04 CST 2019]; root of context hierarchy
[2019-07-16 12:18:05,732] Artifact shiro-web:war exploded: Error during artifact deployment. See server log for details.
七月 16, 2019 12:18:13 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\webapps\manager
七月 16, 2019 12:18:13 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory C:\Users\Administrator\Downloads\apache-tomcat-7.0.79\webapps\manager has finished in 78 ms
错误提示是:credentialsMatcher realm securityManager
is not eligible for getting processed by all BeanPostProcessors
下面是spring配置文件xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!--创建shiroFilter过滤器--> <bean class="org.apache.shiro.spring.web.ShiroFilterFactoryBean" id="shiroFilter"> <property name="securityManager" ref="securityManager" /> <property name="loginUrl" value="login.html"/> <property name="unauthorizedUrl" value="error.html"/> <property name="filterChainDefinitions" > <value> /login.html = anon /subLogin = anon /* = authc </value> </property> </bean> <!--securityManager--> <bean class="org.apache.shiro.web.mgt.DefaultWebSecurityManager" id = "securityManager"> <property name="realm" ref="realm"/> </bean> <!--自定义Realm--> <bean class="com.immoc.realm.Realm" id="realm"> <property name="credentialsMatcher" ref="credentialsMatcher"/> </bean> <!--加盐--> <bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher" id="credentialsMatcher"> <property name="hashAlgorithmName" value="md5"/> <property name="hashIterations" value="1"/> </bean> </beans>
mvcxml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="com.immoc.controller"/> <context:component-scan base-package="com.immoc.realm"/> <mvc:annotation-driven/> <mvc:resources mapping="/*" location="/"/> </beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <!--Spring--> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/spring-conf.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!--springMVC--> <servlet> <servlet-name>SpringMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/spring-mvc.xml</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>SpringMVC</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <!--shiro--> <filter> <filter-name>DelegatingFilterProxy</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>DelegatingFilterProxy</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--乱码过滤器--> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>