Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution of JspFactory report exception after deployment in Tomcat

Shulou Source: shulou.com Published: 2022-06-02 20:47:07 10月01日 Update

In this issue, the editor will bring you the solution to the abnormal JspFactory newspaper after deployment in Tomcat. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

The method getJspApplicationContext (ServletContext) is undefined for the type

Reasons for the exception of JspFactory and the reasons for its solution:

This is due to the conflict between jsp-api.jar and servlet-api.jar under the WEB-INF/lib of the project and the jar package that comes with Tomcat.

Solution:

Delete jsp-api.jar and servlet-api.jar in the Lib directory of the WEB project, and restart the Tomcat service to solve the problem.

When creating a project, the two jar packages jsp-api.jar and servlet-api.jar do not need to be manually added to the web project, and both are included in the Tomcat.

The exception information is as follows:

Org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 23 in the generated java file

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

Stacktrace:

Org.apache.jasper.compiler.DefaultErrorHandler.javacError (DefaultErrorHandler.java:92)

Org.apache.jasper.compiler.ErrorDispatcher.javacError (ErrorDispatcher.java:330)

Org.apache.jasper.compiler.JDTCompiler.generateClass (JDTCompiler.java:423)

Org.apache.jasper.compiler.Compiler.compile (Compiler.java:308)

Org.apache.jasper.compiler.Compiler.compile (Compiler.java:286)

Org.apache.jasper.compiler.Compiler.compile (Compiler.java:273)

Org.apache.jasper.JspCompilationContext.compile (JspCompilationContext.java:566)

Org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:317)

Org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:320)

Org.apache.jasper.servlet.JspServlet.service (JspServlet.java:266)

Javax.servlet.http.HttpServlet.service (HttpServlet.java:803)

Therefore, when deploying in Tomcat, the jar already in Tomcat does not need to be included in the project to avoid conflicts.

The above is the solution to the abnormal JspFactory report after deployment in Tomcat shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Engineering method content method cause conflict analysis specialty two small and medium-sized information rich in content that is manual article more catalogue knowledge article industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Shulou Information Microsoft MariaDB