Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution of JspFactory report exception after deployment in Tomcat

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report