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

导了一个新项目。运行起来,主页都报错。

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

  在tomcat下,打开tomcat编译后的index_jsp.java,代码为

 

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class Index_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  再看看要导入的类和包

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

 

 也就是这几个jar包的错误了。再看看网上大家相同错误的见解。找tomcat/lib(我的是6.0)的启动下tomcat自己加载的包,再对比自己项目中同种类型的包,包版本要比tomcat6中低,造成异常。照着tomcat中包,发现工程中出现诸如catalina.jar、jsp-api.jar
、servlet-api.jar、javax.servlet.jar、javax.servlet.jsp.jar等重复包,把它们从项目中删掉,或者将tomcat下的这些包拷贝到项目中,重启tomcat,就好了。

你可能感兴趣的:(The method getJspApplicationContext(ServletContext) is undefined for the type Js)