Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter报错解决

报错:
Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filte
Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_191] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_191] at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_191] at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:158) ~[spring-core-5.0.12.RELEASE.jar:5.0.12.RELEASE] ... 23 common frames omitted Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191] ... 27 common frames omitted

解决方法:
修改POM文件

注释掉< scope>provided< /scope>

<dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-starter-tomcatartifactId>
    
dependency>

注释掉之后再运行就可以了。

你可能感兴趣的:(后端,java,servlet,hive)