{"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/dubbo/issues/95","labels_url":"https://api.github.com/repos/alibaba/dubbo/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/dubbo/issues/95/comments","events_url":"https://api.github.com/repos/alibaba/dubbo/issues/95/events","html_url":"https://github.com/alibaba/dubbo/issues/95","id":50124145,"number":95,"title":"每次关闭tomcat时就会出错误","user":{"login":"liuyangc3","id":6705844,"avatar_url":"https://avatars.githubusercontent.com/u/6705844?v=3","gravatar_id":"","url":"https://api.github.com/users/liuyangc3","html_url":"https://github.com/liuyangc3","followers_url":"https://api.github.com/users/liuyangc3/followers","following_url":"https://api.github.com/users/liuyangc3/following{/other_user}","gists_url":"https://api.github.com/users/liuyangc3/gists{/gist_id}","starred_url":"https://api.github.com/users/liuyangc3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuyangc3/subscriptions","organizations_url":"https://api.github.com/users/liuyangc3/orgs","repos_url":"https://api.github.com/users/liuyangc3/repos","events_url":"https://api.github.com/users/liuyangc3/events{/privacy}","received_events_url":"https://api.github.com/users/liuyangc3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-11-26T06:37:28Z","updated_at":"2015-03-08T03:07:33Z","closed_at":null,"body":"```\r\n七月 16, 2014 5:01:35 下午 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks\r\n严重: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] \r\n(value [java.lang.ThreadLocal@7da150]) and a value of type [org.r113.servlet3.MyClass] \r\n(value [org.r113.servlet3.MyClass@37e98b70]) but failed to remove it when the web application was stopped. \r\nThreads are going to be renewed over time to try and avoid a probable memory leak.\r\n```\r\n环境tomcat7.0.47 jdk 7u55"},"comment":{"url":"https://api.github.com/repos/alibaba/dubbo/issues/comments/77730155","html_url":"https://github.com/alibaba/dubbo/issues/95#issuecomment-77730155","issue_url":"https://api.github.com/repos/alibaba/dubbo/issues/95","id":77730155,"user":{"login":"kazaff","id":801787,"avatar_url":"https://avatars.githubusercontent.com/u/801787?v=3","gravatar_id":"","url":"https://api.github.com/users/kazaff","html_url":"https://github.com/kazaff","followers_url":"https://api.github.com/users/kazaff/followers","following_url":"https://api.github.com/users/kazaff/following{/other_user}","gists_url":"https://api.github.com/users/kazaff/gists{/gist_id}","starred_url":"https://api.github.com/users/kazaff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kazaff/subscriptions","organizations_url":"https://api.github.com/users/kazaff/orgs","repos_url":"https://api.github.com/users/kazaff/repos","events_url":"https://api.github.com/users/kazaff/events{/privacy}","received_events_url":"https://api.github.com/users/kazaff/received_events","type":"User","site_admin":false},"created_at":"2015-03-08T03:07:33Z","updated_at":"2015-03-08T03:07:33Z","body":"@bohrqiu 首先谢谢答复。\r\nweb.xml：\r\n~~~\r\n<context-param>\r\n        <param-name>contextConfigLocation</param-name>\r\n        <param-value>/WEB-INF/consumer.xml</param-value>\r\n    </context-param>\r\n\r\n    <listener>\r\n        <listener-class>cn.ztydata.listener.DubboShutDownListener</listener-class>\r\n    </listener>\r\n    <listener>\r\n        <listener-class>com.alibaba.dubbo.remoting.http.servlet.BootstrapListener</listener-class>\r\n    </listener>\r\n    <listener>\r\n        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>\r\n    </listener>\r\n~~~\r\n\r\n按照你的方法，我绑定了一个自己实现的监听器，源码如下：\r\n\r\n~~~java\r\npublic class DubboShutDownListener implements ServletContextListener {\r\n\r\n    @Override\r\n    public void contextDestroyed(ServletContextEvent arg0){\r\n        //System.out.println(\"DubboShutDownListener.contextDestroyed called!\");\r\n        try {\r\n            final Class protocolConfig = Class.forName(\"com.alibaba.dubbo.config.ProtocolConfig\");\r\n\r\n            final Method method = protocolConfig.getMethod(\"destroyAll\");\r\n            method.invoke(protocolConfig);\r\n        } catch (Exception e){\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void contextInitialized(ServletContextEvent arg0){\r\n        //System.out.println(\"DubboShutDownListener.contextInitialized called!\");\r\n    }\r\n}\r\n~~~\r\n\r\n也曾尝试过在web.xml中修改监听器的位置，不过都无法解决该报错~"}}