The method getJspApplicationContext(ServletContext) is undefined for the type
JspFactory的异常的原因及解决办法原因:
服务器环境Jboss,Java程由Tomcat5.5工程目录直接拷贝,由于WEB-INF/lib下存在jsp-api.jar、servlet-api.jar,与Jboss自带的jar包冲突造成。
解决办法:
删除WEB工程Lib目录中的jsp-api.jar、servlet-api.jar,重新启动Jboss服务问题解决。
标记:
在创建工程时,jsp-api.jar、servlet-api.jar这两个jar包都无需手工加入到web工程中,tomcat与jboss都已包含。
近在学Acegi,就试着运行一个小例子,不成想抛出下面的异常
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)
上网搜,发现不少人有这个问题,但都没有解决办法。后来想到可能和tomcat6有关,因为我在工程的lib中添加了很多包(一堆什么Spring
依赖),所以把他们一删JSP就不抛异常了。我估计是,工程中和tomcat6 lib中重复的包在加载时是先被加载(也就是tomcat6中相同的包没
有被加载),而工程中的包版本要比tomcat6中的低,造成上面的异常。我对照着tomcat中包,发现工程中出现诸如catalina.jar、jsp-api.jar
、servlet-api.jar等这样的重复包,把它们从工程中删了就应该行了(对于上面的异常,原因应该是包jsp-api.jar)。看来不是什么包都可以一股脑往工程里加啊。
分享到:
相关推荐
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory;java.lang.OutOfMemoryError: PermGen space;tomcat 5.5 的The Apache Tomcat Native library which allows optimal ...
`ServletContext`是Java Web开发中的一个关键概念,它是Servlet API的一部分,主要用于在多个Servlet之间共享信息。在Myeclipse这样的集成开发环境中,我们经常会用到`ServletContext`来增强应用程序的功能和交互性...
在Servlet的世界里,`ServletContext`扮演着至关重要的角色。它是一个全局的、跨.servlet共享的上下文对象,为整个Web应用提供了一个共享数据和资源的平台。在这个实例中,我们将深入探讨`ServletContext`如何用于...
ServletConfig 与 ServletContext 的关系 在 Servlet 编程中,ServletConfig 和 ServletContext 两个对象经常被混淆,然而它们有着截然不同的作用域和用途。 首先, lets 看看 ServletConfig 对象。ServletConfig ...
在Java Web开发中,`ServletContext`是一个至关重要的接口,它代表了整个Web应用程序的上下文。这个上下文包含了关于Web应用的所有信息,如全局的初始化参数、资源、以及与所有Servlet共享的对象。在这个实例中,...
`servletContext`是Servlet API中的一个关键概念,代表了整个Web应用程序的上下文。在这个上下文中,Servlet可以共享信息,如全局属性、监听器等。下面将详细讨论`servletContext`及其在实际开发中的应用。 一、...
ServletContext 读取 web 应用中的资源文件 在 Web 应用程序中,我们经常需要读取某些资源文件,如配置文件、图片等等。为了实现这一点,ServletContext 接口提供了一些方法来读取 web 应用中的资源文件,这些方法...
The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. doGet...
Ssh获取ServletContext 只需要更改struts-config action中的type就可以了ru :type="com.uo.spring.SpringDelegatingActionProxy" 大家有什么疑问可以直接去我的blog查看...《[正解]Ssh获取ServletContext》
【ServletContext与Application的理解】 在Java Web开发中,`ServletContext`和`Application`是两个非常重要的概念,它们在一定程度上有着密切的联系。`ServletContext`是Servlet API中的一个接口,它代表了一个Web...
The `init()` method initializes the servlet, followed by the `service()` method, which processes the request and generates a response. Finally, the `destroy()` method is called when the servlet is no...
超全面javaweb教程28天第9天_14_获取ServletContext对象
在Servlet环境下,特别是在使用Spring MVC等框架时,Quartz与ServletContext的结合配置显得尤为重要,因为这能让我们更好地管理和监控后台定时任务。 ### Quartz简介 Quartz 提供了一个完全线程化的事件调度器,...
### ServletContext接口详解 在Java Web开发中,`ServletContext`接口扮演着至关重要的角色,它提供了应用程序上下文的全局视图,使得多个Servlet之间能够共享数据,并且为Servlet容器提供了访问资源、初始化参数...
【ServletContext详解】 Servlet上下文(ServletContext)是Java Web开发中的一个重要概念,它是服务器为每个Web应用程序创建的一个全局共享对象。这个对象在整个Web应用中独一无二,所有的Servlet都可以访问它,...
`ServletContext`对象是Servlet容器(如Tomcat、Jetty等)为每个Web应用程序创建的一个全局对象,它在整个Web应用的生命周期内都存在,为所有Servlet提供了一个共享数据和资源的平台。在本例中,我们探讨的是如何...
### ServletContext详解 #### 一、概述 `ServletContext`接口是Servlet与Servlet容器之间进行通信的重要接口之一。当Servlet容器启动一个Web应用时,会为该应用创建一个`ServletContext`对象,这个对象在整个Web...
ServletConfig和ServletContext是Java Servlet API中的两个重要接口,它们在Web应用程序中扮演着关键角色,主要负责管理和传递初始化参数以及实现应用级别的通信。 ServletConfig对象主要用于装载Servlet的初始化...
### ServletContext概述与应用 #### 一、ServletContext简介 `ServletContext`是Servlet容器提供的一种机制,用于在Web应用程序的不同组成部分之间共享数据,并提供对整个Web应用程序的全局信息访问。它是Servlet ...