3

使用Session监听器无法监听到,各位大神帮帮忙

图片说明我想做一个Session监听器,用来监听Session销毁和超时的状态,每次销毁时,执行修改数据库数据的一个方法,但是监听器实现HttpSessionListener,Tomcat启动不起来,报错严重: Error configuring application listener of class com.fh.listener.SessionListener
javax.naming.NamingException: Cannot create resource instance;如果监听器继承SessionListenerAdapter,开始Session和关闭Session又进不到监听器中的断点处,请各位大神帮帮忙,怎样解决这个问题,非常感谢!![![图片说明](https://img-ask.csdn.net/upload/201509/11/1441956886_219909.png)图片说明](https://img-ask.csdn.net/upload/201509/11/1441956876_99092.png)图片说明

错误代码
严重: Error configuring application listener of class com.fh.listener.SessionListener
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceEnvFactory.java:115)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
at org.apache.catalina.core.DefaultInstanceManager.lookupFieldResource(DefaultInstanceManager.java:557)
at org.apache.catalina.core.DefaultInstanceManager.processAnnotations(DefaultInstanceManager.java:449)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:135)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4933)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5531)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

查看全部
z__leo
z__leo
2015/09/11 07:35
  • 监听器
  • tomcat
  • session
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复