| ClassCastException for JSP expression language [message #754268] |
Tue, 01 November 2011 13:09  |
warhen Messages: 4 Registered: October 2011 |
Junior Member |
|
|
Hi, I am running the following version of eclipse:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Service Release 1
Build id: 20110916-0149
I am seeing an issue that should be easy to reproduce because it happens after creating a new "Dynamic Web Project" without adding on any project natures or additional libraries.
All you need is to have the following two versions of tomcat installed:
- tomcat version 6 (I have 6.0.20)
- tomcat version 7 (I have 7.0.22)
Once the project is created, I put an index.jsp file in the "WebContent" directory.
The content of index.jsp is:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
${header["user-agent"]}
1) Run As --> Run on Server --> Tomcat v6.0 at localhost
Everything works (I get a webpage that shows what browser is being used).
2) Run As --> Run on Server --> Tomcat v7.0 at localhost
I get the following exception:
org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.jasper.runtime.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:548)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:471)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
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(PageContextImpl.java:982)
org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
I can find "org.apache.jasper.el.ELContextImpl" in the jasper.jar in the tomcat lib folder. However, I don't know where "org.apache.jasper.runtime.ELContextImpl" originates.
I have surfed the web a bit to find clues and the most I've been able to find is the notion that this sort of thing could be due to two separate class loaders clashing.
I can only guess at this point. All I know is that the simplest jsp page will work until you put any jsp expression in it, like ${myVar}.
It would be a relief if anyone has seen this or suspects where I messed up.
Thanks,
Warhen
[Updated on: Tue, 01 November 2011 13:10] Report message to a moderator
|
|
|