wood burning stoves 2.0*
The moose likes JSP and the fly likes JSTL Not working on Tomcat 5.0.28 & Weblogic 8.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL Not working on Tomcat 5.0.28 & Weblogic 8.1" Watch "JSTL Not working on Tomcat 5.0.28 & Weblogic 8.1" New topic
Author

JSTL Not working on Tomcat 5.0.28 & Weblogic 8.1

Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Hello Friends,
I am trying to use JSTL (version 1.1.2 ) in my JSP but it is giving me a error on Tomcat 5.0.28 & it is not working properly on weblogic 8.1.

TLDs are placed properly as well as neccessasry JAR files jstl.jar & standard.jar are inside lib folder of my web application.

JSP Code:



Interesting stuff is on Tomcat iam getting following error (my guess is it is because i am using EL in my code. I think Tomcat 5.0.28 supports JSP 2.0 isn't it? )
================================================================
Tomcat Output: (In Browser)
================================================================
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.servlet.jsp.PageContext.getVariableResolver()Ljavax/servlet/jsp/el/VariableResolver;
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
org.apache.jsp.TestJSTL_jsp._jspService(TestJSTL_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getVariableResolver()Ljavax/servlet/jsp/el/VariableResolver;
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:899)
org.apache.jsp.TestJSTL_jsp._jspx_meth_c_forEach_0(TestJSTL_jsp.java:117)
org.apache.jsp.TestJSTL_jsp._jspService(TestJSTL_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28


==================================================================
Weblogic8.1 Output: As a web page in browser
==================================================================
You Sent the following request headers:

Header Value
${entry.key} ${entry.value}

=================================================================
Header Value appaers in Table properly.


Can anybody tell me wheather i am doing something wrong? or there is a versioning issue?

Thanx in Advance
Shrinivas
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

I dont know about weblogic, but here is how you do it with tomcat.

First of all, there are 2 versions of jstl

1. jstl 1.0 (j2ee 1.3, servlet 2.3 spec) => supported by tomcat 4.x

2. jstl 1.1 (j2ee 1.4, servlet 2.4 spec) => supported by tomcat 5.x

The tld files are packaged with the jars (look in the META-INF directory) and to use the jstl tags ,all you have to is specify the correct uri in your jsps.

1. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> (jstl 1.0)

2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> (jstl 1.1)

You need not

1. extract tld files
2. Have web.xml entries

If your web.xml is servlet version 2.3 (it references a 2.3 dtd), then el expression evaludation is disabled

You can

1. Include this

<%@ page isELIgnored="false" %> in your jsp

2. More permanent solution, especially since you use tomcat 5 which supports servlet 2.4 spec, would be to define web.xml by 2.4 standards (it should reference the 2.4 spec schema).

cheers,
ram.
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Btw, I learnt the above from forum user Stefan Evans (in a different forum, although) - so full credits to him.

cheers,
ram.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
With Weblogic, being a Servlet2.3/JSP1.2 container, you will have to use JSTL1.0. That means you can't use EL expressions outside of the JSTL tags, and the JSTL functions are not available.

With regards to the Tomcat5 issue, It seems you have a class incompatibility issue. According to the API
"Abstract method error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled"
It can't find the method: PageContext.getVariableResolver().
That would suggest that you have an incompatible Version 2.3 ServletAPI in your classpath somewhere.
What files are present in Tomcat's web-inf/lib?
You don't have weblogic.jar there do you?


PS: Hi Ram ;-) You don't need to give me credit like that. (In fact I would prefer you didn't) You know the stuff. The only reason I ended up replying to this thread was that it was a little different from the standard run-of-the-mill JSTL question with regard to that stacktrace error.
 
Consider Paul's rocket mass heater.
 
subject: JSTL Not working on Tomcat 5.0.28 & Weblogic 8.1
 
Similar Threads
No suitable driver
with Action OK, but EL get Error
ServletException: KGBInternet
Regarding EL
doubt in EL