tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: ClassCastException org.apache.jasper.runtime.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
Date Thu, 09 Aug 2012 12:30:27 GMT
2012/8/3 Dale Ogilvie <>:
> Hi,
> I'm seeing this problem below appearing now with one of our web-apps, google has not
helped me so far... There have been no changes with the web app in question, which was working,
so I'm picking something is going on with either the tomcat or OS (virtualized) environment,
but what? Any tips as to how to figure out what is going on?
> root cause
> java.lang.ClassCastException: org.apache.jasper.runtime.ELContextImpl cannot be cast
to org.apache.jasper.el.ELContextImpl
>         org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(
>         org.apache.jsp.WEB_002dINF.views.promoCodeWelcome_jsp._jspx_meth_c_005fout_005f0(
>         org.apache.jsp.WEB_002dINF.views.promoCodeWelcome_jsp._jspService(
>         org.apache.jasper.runtime.HttpJspBase.service(
>         javax.servlet.http.HttpServlet.service(
>         org.apache.jasper.servlet.JspServletWrapper.service(
>         org.apache.jasper.servlet.JspServlet.serviceJspFile(
>         org.apache.jasper.servlet.JspServlet.service(
>         javax.servlet.http.HttpServlet.service(
>         org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(
>         org.springframework.web.servlet.view.AbstractView.render(
>         org.springframework.web.servlet.DispatcherServlet.render(
>         org.springframework.web.servlet.DispatcherServlet.doDispatch(
>         org.springframework.web.servlet.DispatcherServlet.doService(
>         org.springframework.web.servlet.FrameworkServlet.processRequest(
>         org.springframework.web.servlet.FrameworkServlet.doGet(
>         javax.servlet.http.HttpServlet.service(
>         javax.servlet.http.HttpServlet.service(
>         jcifs.http.NtlmHttpFilter.doFilter(
> The app is deployed on Tomcat 7.0.27, java 1.6_026, erroring jsp line:
> <c:out value="${fn:length(promoCodeSpecCommand.user)}" />

> I found the problem, but I am confused as to WHY it is a problem.
> *Another webapp* on the same tomcat instance includes the following jar
> in its WEB-INF/lib:
> jsp-2.1-6.1.14.jar
> This jar contains the offending class
> "org.apache.jasper.runtime.ELContextImpl".
> If I remove this *other* application  (app2) from the server, the
> ClassCastException in app1 goes away.
> I thought the WEB-INF/lib directories for different applications were
> isolated from each other, but in this case it appears app1 is using a
> class from app2. This seems rather bad to me.

1. Tomcat 7.0.26 and earlier has static field
JspApplicationContextImpl.ExpressionFactory, so the EL implementation
is effectively shared between web applications.

This was a bug, noted and fixed in 7.0.27 (see BZ 52998),

2. I do not know why you are observing the issue with 7.0.27.

Either the fix was incomplete,

or maybe the JSPs were compiled with an earlier version of Tomcat. Try
clearing the work folder so that they are recompiled.

or it is caused specifically by "other vendor" using jasper package
names in their classes. E.g. when some jasper classes were loaded by
Tomcat by the first time, it might be loaded from 3rd party JAR
instead of Tomcat.

It is possible to set delegate="true" on a <Loader> element to change
Tomcat classloading behaviour.

3. Regarding protection against "other vendor" using Jasper package classes,

The "package.access" setting in does include the
"org.apache.jasper." package,  so a protection is already in place.
Note though that this setting is only effective when you run with
SecurityManager enabled.

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message