tomcat总是报下面这个错误,该怎么解决啊。。希望各位大神能够帮我解决。。感谢-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

tomcat总是报下面这个错误,该怎么解决啊。。希望各位大神能够帮我解决。。感谢

2016-03-10 09:47:06 1800 1
java.lang.NoClassDefFoundError: Filter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Filter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 26 more
2014-12-18 11:39:10 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter HibernateFilter
java.lang.NoClassDefFoundError: Filter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2957)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:529)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:511)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:139)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Filter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 26 more
2014-12-18 11:39:10 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2014-12-18 11:39:10 org.apache.catalina.core.StandardContext startInternal
严重: Context [/MedicineManager] startup failed due to previous errors
取消 提交回答
全部回答(1)
  • a123456678
    2019-07-17 18:56:52
    下面是Hibernate过滤器
    
    public class HibernateFilter implements Filter{
    // ThreadLocal对象
    private static ThreadLocal threadLocal = new ThreadLocal();
    // SessionFactory对象
    private static SessionFactory factory = null;
    public void destroy() {
    if(!factory.isClosed()){
    factory.close();
    }
    }
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
    try {
    chain.doFilter(request, response);
    } finally{
    Session session = (Session)threadLocal.get();
    if(session != null){
    if(session.isOpen()){
    session.close();
    }
    threadLocal.remove();
    }
    }
    }
    public void init(FilterConfig arg0) throws ServletException {
    //初始化SessionFactory
    try {
    Configuration cfg = new Configuration().configure();
    factory = cfg.buildSessionFactory();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    /**
    * 获取Session
    * @return Session
    */
    public static Session getSession() {
    Session session = (Session)threadLocal.get();
    if (session == null) {
    session = factory.openSession();
    threadLocal.set(session);
    }
    return session;
    }
    }
    0 0
相关问答

1

回答

Tomcat是什么?

2021-10-31 18:21:07 81浏览量 回答数 1

1

回答

为什么tomcat的进程自动被kill了

2016-06-15 16:17:03 3967浏览量 回答数 1

1

回答

tomcat总是自动关闭

2016-06-07 14:24:45 4648浏览量 回答数 1

1

回答

下面有关 tomcat运行错误信息,求解?

2016-06-01 18:31:19 1325浏览量 回答数 1

1

回答

下面问题中有关Tomcat乱码问题

2016-06-03 14:58:01 2041浏览量 回答数 1

1

回答

tomcat无法启动,下面是错误信息,求助大神,如何解决?

2016-06-03 14:09:13 1786浏览量 回答数 1

1

回答

下面问题中相关tomcat配置域名的问题

2016-06-03 10:27:55 1667浏览量 回答数 1

1

回答

下面的图中,tomcat什么问题?

2016-03-25 17:02:17 1556浏览量 回答数 1

1

回答

tomcat链接memcached失败

2016-03-26 10:34:07 1581浏览量 回答数 1

9

回答

tomcat总是自动停止

2014-11-20 11:35:32 25088浏览量 回答数 9
+关注
0
文章
14879
问答
问答排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载