tags:

views:

641

answers:

3

i am building a GWT project, with GWT-2.0.3 and eclipse plugin. well, first i tried, JSTL1.2 and servlet 2.5,

  • i do add jstl-1.2.jar to war/WEB-INF/lib
  • in web.xml, i use:

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        id="WebApp_ID" version="2.5">
    
  • in the jsp page, i use:

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
    
    <c:forEach var="app" items="${requestScope.apps}">
        <tr><td width=20%><c:out value="${app.mapping}"></c:out></td>
        <td width=40%><c:out value="${app.description}"></c:out></td>
        ...
    

If I remove the foreach tag, it works fine. but if I use the core tags, I get the following exception:

HTTP ERROR: 500

javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
RequestURI=/system/view/register.html

Caused by:

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
    at javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:587)
    at javax.servlet.jsp.jstl.core.LoopTagSupport.doFinally(LoopTagSupport.java:323)
    at org.apache.jsp.system.view_jsp._jspx_meth_c_forEach_0(view_jsp.java:267)
    at org.apache.jsp.system.view_jsp._jspx_meth_a_body_0(view_jsp.java:186)
    at org.apache.jsp.system.view_jsp._jspService(view_jsp.java:98)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:285)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at org.app4j.test.DispatchServlet.doGet(DispatchServlet.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Powered by Jetty://

If i deploy the project to Tomcat 6, it works fine. i search on the web, and i find a article, "JSP Expression Language in GWT’s embedded Jetty", so i tried jstl-1.1 and servlet2.4, but i still get that exception.
i find the GWT's jetty server version should be 6.1, but i am not sure about it, if that is true, it should support EE5, so any one has integrated GWT and JSTL? please help! thanks.

+2  A: 

I'd recommend just switching to an external Java server (like Tomcat, which you seem to have installed and which works with your configuration) - much less problems, easier than trying to work with the crippled Jetty that comes with GWT.

The instructions can be found in the docs. If you stick with GWT's Jetty, you will only run into more issues in the future.


Update, see comment by Pascal Thivent below:

@Pascal: sorry for that, I didn't mean to just say "Switch to external server, no talking", it's just that I've seen a lot of people on SO and on GWT's Google Group that have problems configuring Jetty that comes with GWT - in some cases it's because the configuration is somewhat different than standard, because the GWT team included an older/modified (I can't get any solid info on this) version of Jetty, for example see this post and comments there, some quotes:

NOTE: I believe the version of jetty shipped with GWT is below 6.1.12 and therefore you must leave off the first parameter in the example docs as it was added in jetty 6.1.12rc3. See the note at the top of the Jetty documents page.


Supposedly Jetty supports the servlet 2.5 specification and resource injection via the web.xml entry or @resource annotation. However, I have yet to figure out if this is supported by the Jetty version shipped with GWT. If anyone has figured out whether or not this works and if so how it is done please let me know.

Other problems occur when someone wants to use EJB.

All that (maybe in a more condensed/cryptic way) is written in GWT's documentation - for which I provided a link above to the exact paragraph addressing this issue.
Hopefully, that cleared up some things - switching to an external server just seems like the easiest, simplest and best solution - no "special GWT" configuration, meaning you can use the same configuration/server that you'll be using in production, no need to migrate your configuration to, for example, Tomcat, no unexpected bugs after migration, etc.

Igor Klimer
thanks very much, i thought i could not use hosted mode if i switch to tomcat.
Brodie
No links to specific issues, no particular problem mentioned, no reference, nothing. The only thing I see in this answer is FUD,
Pascal Thivent
You're right, I've edited my answer to clarify this, hopefully it's less FUD and more up to the usual (high) standard on SO :)
Igor Klimer
A: 
java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;

The webapp's runtime classpath is likely cluttered with a different version of EL JAR file (either an older version or the one of a different appserver) which lacks the in the exception mentioned method. I suspect the /WEB-INF/lib. Get rid of it, it's normally already supplied by the appserver in question, you don't need to include it in your webapp. This applies on all appserver libraries like servlet-api.jar and consorts by the way. You should never copy it into the webapp's /WEB-INF/lib. That's asking for portability trouble.

BalusC
A: 

I stumbled on this while I was looking for fix JSTL for my app engine project. I found the answer on "Will It Play" page by google. Apparently you have to add

<%@page isElIgnored="false" %>

to your JSP pages to enable EL parsing.

Gvenez