Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/Filter

idea在运行springboot程序时报如下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/Filter


解决方法:在对应的module下添加tomcat lib下面的jar包 

file ——> project structure


点击右边绿色的“+”,选择 "jars and directories..."


    选择其中一个tomcat的lib目录,点击ok


    如图,之后apply,ok


    然后运行程序,程序正确运行


猜你喜欢

转载自blog.csdn.net/weixin_39274753/article/details/79702081