Expression Language Not Being Evaluated - NSM Exception with isELIgnored false

D

Dale

I recently downloaded JBoss with Tomcat 5.0.26 and created a jsp with
something like "<font color="red">Message:${param.msg}</font>" and it
was rendered in the browser as "Message:${param.msg}". So I figured
I'd just turn on EL... I put
<%@ page isELIgnored="false" %> in my jsp, but then I get this:
java.lang.NoSuchMethodError:
javax.servlet.jsp.PageContext.getVariableResolver(), which I googled
and got no hits. It doesn't surprise me that it got a no such method,
since in the 1.4 API, I don't see a getVariableResolver method. It's
almost like it should be using some other PageContect implementation.

Ideas?

Does this work for anyone else?

--Dale--
 
J

John C. Bollinger

Dale said:
I recently downloaded JBoss with Tomcat 5.0.26 and created a jsp with
something like "<font color="red">Message:${param.msg}</font>" and it
was rendered in the browser as "Message:${param.msg}". So I figured
I'd just turn on EL... I put
<%@ page isELIgnored="false" %> in my jsp, but then I get this:
java.lang.NoSuchMethodError:
javax.servlet.jsp.PageContext.getVariableResolver(), which I googled
and got no hits. It doesn't surprise me that it got a no such method,
since in the 1.4 API, I don't see a getVariableResolver method. It's
almost like it should be using some other PageContect implementation.

Ideas?

You may be looking at the wrong API, but it's hard to tell because you
don't fully specify. The JSP API is part of J2EE, not J2SE, and version
numbers of the two don't necessarily have to match. You need JSP 2.0,
which is part of J2EE 1.4. In that version of the API, PageContext is a
subclass of JspContext, from which it inherits the getVariableResolver
method. In other words, either your webapp or Tomcat is misconfigured.

My best guess would be that you have a copy of the JSP 1.2 (or earlier)
API classes in your webapp's local classpath, possibly by itself but
more likely packaged together with the whole Servlet API (version 2.3 or
earlier). For instance, you might have a file named servlet.jar in
WEB-INF/lib. You should _never_ supply a webapp with its own copy of
the servlet API; the container will make the correct implementation
available to all webapps.


John Bollinger
(e-mail address removed)
 
D

Dale

John C. Bollinger said:
You may be looking at the wrong API, but it's hard to tell because you
don't fully specify. The JSP API is part of J2EE, not J2SE, and version
numbers of the two don't necessarily have to match. You need JSP 2.0,
which is part of J2EE 1.4. In that version of the API, PageContext is a
subclass of JspContext, from which it inherits the getVariableResolver
method. In other words, either your webapp or Tomcat is misconfigured.

My best guess would be that you have a copy of the JSP 1.2 (or earlier)
API classes in your webapp's local classpath, possibly by itself but
more likely packaged together with the whole Servlet API (version 2.3 or
earlier). For instance, you might have a file named servlet.jar in
WEB-INF/lib. You should _never_ supply a webapp with its own copy of
the servlet API; the container will make the correct implementation
available to all webapps.


John Bollinger
(e-mail address removed)

John, You are as kind as you are wise; thanks for understanding my
query and replying with the exact location of the problem.

I -think- what happened in this case was that an Eclipse .classpath
that had a bad reference to javax.servlet.jar was handed-out. The
result was that the project wouldn't build until Eclipse was happy
with the all library entries. Someone decided to make Eclipse happy
by finding an old copy of javax.servlet.jar and placing it where the
..classpath file said it should go... right smack where an old copy of
the jar file didn't belong! The true solution would have been to
simply remove the entry from the .classpath file. So, after your
post, I did just that. Once that was done, it worked like a charm.
Again, your reference to servlet.jar was dead-on. Thanks.

--Dale--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top