首页 新闻 会员 周边 捐助

tomcat启动异常之shiro,,,,,

0
悬赏园豆:20 [待解决问题]

本地部署异常

第一次出现这个问题的时候:那会刚整合shiro第一天项目ok第二天启动就404了,经过n段时间换了个环境合tomcat好了

这次点了一个clean就崩了。。。。。。。下面日志

2017-12-10 14:37:06,425 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationFactory] - Configuring ehcache from InputStream
  2017-12-10 14:37:06,484 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.DiskStoreConfiguration] - Disk Store Path: C:\Users\流年拓荒者\AppData\Local\Temp\
  2017-12-10 14:37:06,535 [localhost-startStop-1] DEBUG [net.sf.ehcache.util.PropertyUtil] - propertiesString is null.
  2017-12-10 14:37:06,540 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheManagerEventListenerFactory class specified. Skipping...
  2017-12-10 14:37:06,568 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,568 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,570 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,574 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - No BootstrapCacheLoaderFactory class specified. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - CacheWriter factory not configured. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - No CacheExceptionHandlerFactory class specified. Skipping...
  2017-12-10 14:37:06,575 [localhost-startStop-1] WARN  [net.sf.ehcache.Cache] - Cache: shiro-activeSessionCache has a maxElementsInMemory of 0.  In Ehcache 2.0 this has been changed to mean a store with no capacity limit. Set it to 1 if you want no elements cached in memory
  2017-12-10 14:37:06,595 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - Initialised cache: shiro-activeSessionCache
  2017-12-10 14:37:06,595 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured. Skipping for 'shiro-activeSessionCache'.
  2017-12-10 14:37:06,595 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured for defaultCache. Skipping for 'shiro-activeSessionCache'.
  2017-12-10 14:37:06,602 [localhost-startStop-1] DEBUG [net.sf.ehcache.store.compound.factories.DiskOverflowStorageFactory] - Deleting data file sampleCache1.data
  2017-12-10 14:37:06,614 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - Initialised cache: sampleCache1
  2017-12-10 14:37:06,614 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured. Skipping for 'sampleCache1'.
  2017-12-10 14:37:06,614 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured for defaultCache. Skipping for 'sampleCache1'.
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - Initialised cache: sampleCache2
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured. Skipping for 'sampleCache2'.
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured for defaultCache. Skipping for 'sampleCache2'.
  2017-12-10 14:37:06,615 [localhost-startStop-1] WARN  [net.sf.ehcache.Cache] - Cache: authenticationCache has a maxElementsInMemory of 0.  In Ehcache 2.0 this has been changed to mean a store with no capacity limit. Set it to 1 if you want no elements cached in memory
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - Initialised cache: authenticationCache
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured. Skipping for 'authenticationCache'.
  2017-12-10 14:37:06,615 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured for defaultCache. Skipping for 'authenticationCache'.
  2017-12-10 14:37:06,615 [localhost-startStop-1] WARN  [net.sf.ehcache.Cache] - Cache: authorizationCache has a maxElementsInMemory of 0.  In Ehcache 2.0 this has been changed to mean a store with no capacity limit. Set it to 1 if you want no elements cached in memory
  2017-12-10 14:37:06,616 [localhost-startStop-1] DEBUG [net.sf.ehcache.Cache] - Initialised cache: authorizationCache
  2017-12-10 14:37:06,616 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured. Skipping for 'authorizationCache'.
  2017-12-10 14:37:06,616 [localhost-startStop-1] DEBUG [net.sf.ehcache.config.ConfigurationHelper] - CacheDecoratorFactory not configured for defaultCache. Skipping for 'authorizationCache'.
  2017-12-10 14:37:06,617 [localhost-startStop-1] INFO  [org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker] - Bean 'cacheManager' of type [class org.apache.shiro.cache.ehcache.EhCacheManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  2017-12-10 14:37:06,618 [localhost-startStop-1] DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Ignoring bean class loading failure for bean 'jdbcRealm'
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.ssm.realm.ShiroRealm] for bean with name 'jdbcRealm' defined in file [D:\eclipse\SSMshiro\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ZYOA1\WEB-INF\classes\applicationContext-shrio.xml]; nested exception is java.lang.ClassNotFoundException: com.ssm.realm.ShiroRealm
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:591)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1386)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:434)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:404)
    at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:187)
    at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:73)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:101)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:330)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:293)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:422)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1571)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)

shiro.xml

    <!-- 1. 配置 SecurityManager! -->
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
        <property name="cacheManager" ref="cacheManager" />
        
        <property name="realms">
            <ref bean="jdbcRealm" />
        </property>
    </bean>

    <!-- 2. 配置 CacheManager. 2.1 需要加入 ehcache 的 jar 包及配置文件. -->
    <bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">

        <property name="cacheManagerConfigFile" value="classpath:ehcache.xml" />
    </bean>

   
    <!-- 3. 配置 Realm 3.1 直接配置实现了 org.apache.shiro.realm.Realm 接口的 bean -->
    <bean id="jdbcRealm" class="com.ssm.realm.ShiroRealm">

        <!-- 配置加密所需要的一个属性值,他有算法名和加密次数需要配置 -->


        <!-- <property name="credentialsMatcher">
            <bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
                <property name="hashAlgorithmName" value="MD5"></property>
                <property name="hashIterations" value="1024"></property>
            </bean>
        </property> -->


    </bean>



    <!-- 4. 配置 LifecycleBeanPostProcessor. 可以自定的来调用配置在 Spring IOC 容器中 shiro 
        bean 的生命周期方法. -->
    <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />

    <!-- 5. 启用 IOC 容器中使用 shiro 的注解. 但必须在配置了 LifecycleBeanPostProcessor 之后才可以使用. -->
    <bean
        class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
        depends-on="lifecycleBeanPostProcessor" />
    <bean
        class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
        <property name="securityManager" ref="securityManager" />
    </bean>

    <!-- 6. 配置 ShiroFilter. 6.1 id 必须和 web.xml 文件中配置的 DelegatingFilterProxy 
        的 <filter-name> 一致. 若不一致, 则会抛出: NoSuchBeanDefinitionException. 因为 Shiro 会来 
        IOC 容器中查找和 <filter-name> 名字对应的 filter bean. -->
    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager" />
    
        <property name="loginUrl" value="/login.jsp" />
        <property name="successUrl" value="/pages/index.jsp" />
        <property name="unauthorizedUrl" value="/unauthorized.jsp" />

sql.xml

复制代码
    <!-- 配置 读取properties文件 jdbc.properties -->
    <context:property-placeholder location="classpath:jdbc.properties" />

    <!-- 配置 数据源 -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
         <!-- 数据库连接池配置 -->
        <property name="initialSize" value="20" /><!-- 初始化连接数量 -->
        <property name="minIdle" value="5" />   <!-- 最小空闲连接数量 -->   
        <property name="maxActive" value="1500" /> <!-- 最大连接数量 --> 
        <property name="maxWait" value="60000" />  <!-- 最大建立连接等待时间(毫秒)。如果超过此时间将接到异常。设为-1表示无限制-->
        <property name="timeBetweenEvictionRunsMillis" value="60000" />  <!--  配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒   -->
        <property name="minEvictableIdleTimeMillis" value="300000" />   <!-- 配置一个连接在池中最小生存的时间,单位是毫秒   -->
        <property name="validationQuery" value="SELECT 'x'" />  
        <property name="testWhileIdle" value="true" />  <!--空闲时是否进行验证,检查对象是否有效 -->   
        <property name="testOnBorrow" value="false" />  <!--取得对象时是否进行验证,检查对象是否有效 -->           
        <property name="testOnReturn" value="false" />  <!--返回对象时是否进行验证 -->       
           <!--  打开PSCache,并且指定每个连接上PSCache的大小   -->
        <property name="poolPreparedStatements" value="true" />  <!-- 表明是否开启statement cache,默认为false,也就是不开启 -->       
        <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />  <!-- statement cache的大小,默认为-1,也就是不限制 -->
        
        <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计   -->
        <property name="filters" value="stat" />
    </bean>
复制代码
流年拓荒者的主页 流年拓荒者 | 初学一级 | 园豆:61
提问于:2017-12-10 14:55
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册