Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
678 views
in Technique[技术] by (71.8m points)

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

I am working on a JSP project that uses Apache Tomcat 7.

When running the project on its loading index.html it's OK, but when trying to navigate to another page it's showing the error:

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

Please provide me a solution to get rid of this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Get rid of any servletcontainer-specific libraries such as jsp-api.jar in your /WEB-INF/lib folder. This exception indicates that you've put servletcontainer-specific libraries of a container which supports only Servlet 2.4 / JSP 2.0 or older in there (the getJspApplicationContext() method was introduced in Servlet 2.5 / JSP 2.1). This is a major mistake. Those libraries don't belong in the webapp's classpath.

Perhaps you did this to overcome project compilation errors, which is indeed a pretty common beginner's mistake. This should have been solved differently, you should refer the target runtime in your project, not copy some libraries of an arbitrary servletcontainer make/version into your project. It would make your project incompatible with servletcontainers of a different make and/or version.

See also:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...