• 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>  
    
  • 相关阅读:
    Synplify9.6.2破解(转帖)
    让博客园博客自动生成章节目录索引
    如何学好FPGA
    verilog 不可综合语句
    在FPGA中使用for循环一定浪费资源吗?
    在verilog中调用VHDL模块
    C#和Java中执行SQL文件脚本的代码(非常有用)
    C#通用JSON帮助类
    公共的Json操作C#类
    Calendar.NET
  • 原文地址:https://www.cnblogs.com/digdeep/p/4162730.html
Copyright © 2020-2023  润新知