springboot访问jsp页面报错 10C

springboot访问jsp页面一直报如下错误java.lang.ClassNotFoundException: javax.servlet.Servlet
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:411) ~[na:1.8.0_77]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:148) ~[spring-boot-devtools-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_77]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_77]
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadFromParent(TomcatEmbeddedWebappClassLoader.java:112) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.doLoadClass(TomcatEmbeddedWebappClassLoader.java:85) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:68) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:123) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:60) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77]
at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77]
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77]
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:129) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:60) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:159) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:185) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:394) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:315) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar:8.5.34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar:8.5.34]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]

4个回答

是不是少了servlet-api.jar包,在pom.xml中加入依赖看下

  <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>
qq_37969990
下一站_上海 不是这个问题
大约一年之前 回复

原因:tomcat找不到servlet,即缺少了servlet-api.jar包
在pom.xml中加入依赖


 <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>
qq_34872748
L星火燎原 回复下一站_上海: 你把你代码截图贴出来让大伙瞧瞧
大约一年之前 回复
qq_37969990
下一站_上海 不是这个原因
大约一年之前 回复
把项目clean一下重新编译一下。还是不行的话。
看异常的话 就是少jar 包。 servlet-api  要么 jsp-api 
都试试吧

如果引入了servlet-api还报错就是下载的jar不完整,一般是因为IDE在下载jar时网络被强制中断或者不稳定引起的,最直接的换一个maven仓库路径,或者找到jar在仓库中的位置将其删除然后再选中maven update。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
单个访问每个页面可以显示 但是从index.jsp的frame框架中链接其他页面就会报错,为什么呢?
1
springboot配置支持jsp依赖报错,但是不影响项目运行。
1
Spring Boot 访问JSP页面 跳转下载
2
SpringMVC在Controller类中获取jsp页面中的json串,使用@ResponseBody来返回json串给页面,报错
1
springboot 2.x.x整合jsp的时候,二级目录下jsp不能访问
6
tomcat启动是正常的也可以访问,但是一段时间以后servlet不能访问,jsp仍然可以访问。
7
jsp页面中的表单提交数据,如果数据保存失败后转发回原来这个jsp页面,那么如何保留原来jsp页面中刚才表单中填写的内容?
3
springboot使用jsp的时候需要引用配置,但是有个疑问
4
求助大佬淘淘商城访问后台Jsp报错jquery-easyui.min.js报错404错误
3
springboot整合jsp一直报出404错误?
1
Springboot启动报错 一个是找不到url 一个是找不到dao
2
myeclipse在有jsp中自带的全局声明的时候,静态引入jsp的时候报错
2
线上发布时某个jsp报错
1
发布项目时jsp标签报错,在本地时候没有任何问题
1
后台没有报错,访问JSP页面一直报404,Tomcat自带主页能正常访问
1
在JSP页面创建了一个类对象,当启动TOMCAT服务时在Myelipse就会自动跳转到Debug页面报错,页面不能正常访问
2
本系统为https,内嵌另一个系统(http)的一个jsp, 采用response.sendRedirect(url)的方式, 页面报the request has bean blocked, 有什么解决方案吗?
1
Springboot+jsp访问页面只显示源码
2
jsp页面在谷歌和火狐显示不出图片是怎么回事?
3
Springboot项目部署问题