• org.apache.jasper.JasperException: Unable to compile class for JSP


    项目启动时报错 :

    The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

    Stacktrace:] with root cause
    org.apache.jasper.JasperException: Unable to compile class for JSP:

    An error occurred at line: [31] in the generated java file: [E:digdeep2.metadata.pluginsorg.eclipse.wst.server.core mp0workCatalinalocalhostminisnsorgapachejspindex_jsp.java]
    The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

    Stacktrace:
        at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
        at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
        at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

    原因是:项目自带的servlet-api和tomcat中servlet-api冲突,

    解决办法:

    在 pom.xml文件中加入scope选项:

    <dependency> 
       <groupId>javax.servlet</groupId> 
       <artifactId>servlet-api</artifactId> 
       <version>2.4</version> 
       <scope>provided</scope> 
    </dependency>
    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>jsp-api</artifactId>
       <version>2.0</version>
       <scope>provided</scope>
    </dependency>  
    
  • 相关阅读:
    Web性能压力测试工具之WebBench详解
    Request Header Or Cookie Too Large
    手动删除SVCH0ST.EXE的方法
    微信非80端口网页授权
    微信公众号开发80端口映射解决方案 推荐
    解决微信访问 80 端口的限制问题
    Windows查看所有的端口及端口对应的程序
    Windows环境下,用netstat命令查看某个端口号是否占用
    价值观--我的总结
    价值是事物由人(基于自己的需要和获取的难度而)作出的评价而存在的属性
  • 原文地址:https://www.cnblogs.com/digdeep/p/4162730.html
Copyright © 2020-2023  润新知