记一次redis踩坑

昨天和今天在实现redis缓存的时候,添加了一个SessionExpireFilter来更新当前登录用户的过期时间,在web.xml文件中配置了filter之后,tomcat死活启动不了,server里面报错:

One or more Filters failed to start. Full details will be found in the appropriate container log file ...

之后在C盘中找到了.interlliJ2019/system/tomcat/当前工程  下的logs目录,查看了此时的catalina.log和localhost.log

结果如下:

catalina.log

localhost.log

于是去google这个错误localhost.log中的这个错误:

严重: Exception starting filter SessionExpireFilter
javax.naming.NamingException: Cannot create resource instance

搜到结果如下所示:

于是在自己的SessionExpireFilter中修改了自己的代码:

private RedisTemplate redisTemplate=new ClassPathXmlApplicationContext("applicationContext.xml").getBean(RedisTemplate.class);

重新启动,成功!

猜你喜欢

转载自www.cnblogs.com/reecelin/p/11922341.html