日期:2014-05-17  浏览次数:20697 次

tomcat与jsp问题??
   在网上找了关于tomcat的配置及使用文档,按着上面的做,启动后能打开http://localhost:8080/。然后按提示在webapps里创建myapp/WEB-INF/web.xml。在myapp中添加一index.jsp,启动tomcat,在浏览器输入http://localhost:8080/myapp/index.jsp,却错误org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 22 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:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

在网上找了许多答案,还是不能解决问题,我快被这东西搞疯了,哪位大侠帮帮忙,感激涕零!!

------解决方案--------------------
1、更改jdk版本;2、查看环境变量;
------解决方案--------------------
[LOCAL] servlet.jar
[MAVEN2] j2ee-1.4.jar
[MAVEN2] javax.servlet-5.1.11.jar
[MAVEN2] javax.servlet-5.1.12.jar
[MAVEN2] servlet-4.0.6.jar
[MAVEN2] servlet-4.1.34.jar
[MAVEN2] servlet-4.1.36.jar
[MAVEN] servletapi-2.2.jar
[MAVEN] servletapi-2.3.jar
[MAVEN2] devtools-1.1-all.jar
[MAVEN2] geronimo-j2ee_1.4_spec-1.0.jar
[MAVEN2] geronimo-j2ee_1.4_spec-1.1.jar
[MAVEN2] geronimo-jsp_2.0_spec-1.0.1.jar
[MAVEN] geronimo-jsp_2.0_spec-1.0.jar
[MAVEN2] geronimo-jsp_2.0_spec-1.0.jar
[MAVEN2] geronimo-jsp_2.0_spec-1.1.jar
[MAVEN2] geronimo-jsp_2.1_spec-1.0.1.jar
[MAVEN2] geronimo-jsp_2.1_spec-1.0.jar
[LOCAL] gwt-dev-windows.jar
[MAVEN2] jackrabbit-standalone-1.5.0.jar
[MAVEN2] jackrabbit-standalone-1.5.2.jar
[MAVEN2] jackrabbit-standalone-1.5.3.jar
[MAVEN2] jackrabbit-standalone-1.5.4.jar
[MAVEN2] jackrabbit-standalone-1.5.5.jar
[MAVEN2] jackrabbit-standalone-1.5.6.jar
[MAVEN2] jetty-6.0.0beta10-standalone.jar
[MAVEN2] jsp-api-2.0.jar
[MAVEN2] jsp-api-2.0.jar
[MAVEN2] jsp-api-2.1.jar
[MAVEN2] jsp-api-5.0.16.jar
[MAVEN2] jsp-api-5.0.18.jar
[MAVEN2] jsp-api-5.5.12.jar
[MAVEN2] jsp-api-5.5.15.jar
[MAVEN2] jsp-api-5.5.23.jar
[MAVEN2] jsp-api-6.0.13.jar
[MAVEN2] jsp-api-6.0.14.jar
[MAVEN2] jsp-api-6.0.16.jar
[MAVEN2] jsp-api-6.0.18.jar
[MAVEN2] jsp-api-6.0.20.jar
[MAVEN2] org.apache.sling.scripting.jsp-2.0.2-incubator.jar
[MAVEN2] org.apache.sling.scripting.jsp-2.0.6-incubator.jar
[MAVEN2] servlet-api-2.2.jar
[MAVEN2] servlet-api-2.3.jar
[MAVEN2] camel-web-standalone-2.0.0.jar
[MAVEN2] geronimo-jsp_2.1_spec-1.0-M1.jar
[MAVEN2] groovysoap-all-jsr06-0.1.jar
[MAVEN2] gwt-dev-1.4.62-leopard.jar
[MAVEN2] gwt-dev-1.4.62-linux.jar
[MAVEN2]&nb