Jetty

When using MyFaces on Jetty 5 - ELResolver fails when object not found

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 5.x
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    OS X, JDK 5, Maven 2, AppFuse 2.0 with MyFaces 1.2.0
  • Number of attachments :
    0

Description

When viewing a page that doesn't exist, the following (from messages.jsp) throws the error below:

<c:if test="${not empty errors}">
<div class="error" id="errorMessages">
<c:forEach var="error" items="${errors}">
<img src="<c:url value="/images/iconWarning.gif"/>"
alt="<fmt:message key="icon.warning"/>" class="icon" />
<c:out value="${error}" escapeXml="false"/><br />
</c:forEach>
</div>
</c:if>

Caused by: javax.faces.el.EvaluationException: ELResolver cannot handle a null base Object with identifier 'errors'

Everything works fine on Tomcat 6.0.14.

http://www.nabble.com/Is-it-possible-to-exclude-commons-el-as-a-dependency-with-the-maven-jetty-plugin--tf4348944.html#a12391297
http://issues.appfuse.org/browse/APF-856

Activity

Hide
Matt Raible added a comment -

This should say Jetty 6.1.6 (I'm using the maven-jetty-plugin), not version 5.x. Thanks.

Show
Matt Raible added a comment - This should say Jetty 6.1.6 (I'm using the maven-jetty-plugin), not version 5.x. Thanks.
Hide
Jan Bartel added a comment -

Matt,

I don't have 6.1.6 to hand, but testing this on jetty6.1.7 both standalone and the maven plugin is working fine. I'm using jdk1.5 and myfaces 1.1.5 (bit old now I know).

I created a little jsp like so:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head><title>Localized Dates</title></head>
<body bgcolor="white">

<c:if test="${!empty param.foo}" >
<b>foo</b>
</c:if>

<c:if test="${empty param.foo}">
<b>!foo</b>
</c:if>

<c:if test="${! empty param.foo}">
<div class="error" id="errorMessages">
<c:forEach var="error" items="${param.foo}">
<c:out value="${error}" escapeXml="false"/><br />
</c:forEach>
</div>
</c:if>

</body>
</html>

Try urls like:

http://localhost:8080/test/jsp/fff.jsp?foo=a,b,c
http://localhost:8080/test/jsp/fff.jsp

Then, I tested the same jsp under MyFaces. I modified the jsp to include the jsf tags:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<html>
<head><title>Localized Dates</title></head>
<body bgcolor="white">

<c:if test="${!empty param.foo}" >
<b>foo</b>
</c:if>

<c:if test="${empty param.foo}">
<b>!foo</b>
</c:if>

<c:if test="${! empty param.foo}">
<div class="error" id="errorMessages">
<c:forEach var="error" items="${param.foo}">
<c:out value="${error}" escapeXml="false"/><br />
</c:forEach>
</div>
</c:if>

</body>
</html>

I used the same urls and got the same results.

So I can't see that this is a jetty problem from the test results, so I'll close the issue for now. However, if you can provide more information, and help pinpoint the problem, then please do reopen this.

cheers
Jan

Show
Jan Bartel added a comment - Matt, I don't have 6.1.6 to hand, but testing this on jetty6.1.7 both standalone and the maven plugin is working fine. I'm using jdk1.5 and myfaces 1.1.5 (bit old now I know). I created a little jsp like so: <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head><title>Localized Dates</title></head> <body bgcolor="white"> <c:if test="${!empty param.foo}" > <b>foo</b> </c:if> <c:if test="${empty param.foo}"> <b>!foo</b> </c:if> <c:if test="${! empty param.foo}"> <div class="error" id="errorMessages"> <c:forEach var="error" items="${param.foo}"> <c:out value="${error}" escapeXml="false"/><br /> </c:forEach> </div> </c:if> </body> </html> Try urls like: http://localhost:8080/test/jsp/fff.jsp?foo=a,b,c http://localhost:8080/test/jsp/fff.jsp Then, I tested the same jsp under MyFaces. I modified the jsp to include the jsf tags: <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <html> <head><title>Localized Dates</title></head> <body bgcolor="white"> <c:if test="${!empty param.foo}" > <b>foo</b> </c:if> <c:if test="${empty param.foo}"> <b>!foo</b> </c:if> <c:if test="${! empty param.foo}"> <div class="error" id="errorMessages"> <c:forEach var="error" items="${param.foo}"> <c:out value="${error}" escapeXml="false"/><br /> </c:forEach> </div> </c:if> </body> </html> I used the same urls and got the same results. So I can't see that this is a jetty problem from the test results, so I'll close the issue for now. However, if you can provide more information, and help pinpoint the problem, then please do reopen this. cheers Jan
Hide
Matt Raible added a comment -

This issue only happens with MyFaces 1.2.0, not 1.1.5. Can you try again with MyFaces 1.2.0+?

Thanks,

Matt

Show
Matt Raible added a comment - This issue only happens with MyFaces 1.2.0, not 1.1.5. Can you try again with MyFaces 1.2.0+? Thanks, Matt
Hide
Jan Bartel added a comment -

Matt,

What result did you get from the simple jsp I pasted above?

Jan

Show
Jan Bartel added a comment - Matt, What result did you get from the simple jsp I pasted above? Jan
Hide
Matt Raible added a comment -

The JSP you have above uses param.* and since param is never null, the error never occurs. I'm using Facelets and I created the following page.

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:v="http://corejsf.com/validator">
<head><title>Localized Dates</title></head>
<body bgcolor="white">

<c:if test="${!empty param.foo}" >
<b>foo</b>
</c:if>

<c:if test="${empty param.foo}">
<b>!foo</b>
</c:if>

<c:if test="${not empty errors}">
<div class="error" id="errorMessages">
<c:forEach var="error" items="${errors}">
${error}
</c:forEach>
</div>
</c:if>

</body>
</html>

Running this shows the following error:

com.sun.facelets.tag.TagAttributeException: /jetty470.xhtml @16,34 test="${not empty errors}" /jetty470.xhtml @16,34 test="${not empty errors}": ELResolver cannot handle a null base Object with identifier 'errors'
at com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.java:235)
at com.sun.facelets.tag.TagAttribute.getBoolean(TagAttribute.java:79)
at com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:509)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:552)
at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.appfuse.webapp.filter.MessageFilter.doFilter(MessageFilter.java:46)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

Show
Matt Raible added a comment - The JSP you have above uses param.* and since param is never null, the error never occurs. I'm using Facelets and I created the following page. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:t="http://myfaces.apache.org/tomahawk" xmlns:v="http://corejsf.com/validator"> <head><title>Localized Dates</title></head> <body bgcolor="white"> <c:if test="${!empty param.foo}" > <b>foo</b> </c:if> <c:if test="${empty param.foo}"> <b>!foo</b> </c:if> <c:if test="${not empty errors}"> <div class="error" id="errorMessages"> <c:forEach var="error" items="${errors}"> ${error} </c:forEach> </div> </c:if> </body> </html> Running this shows the following error: com.sun.facelets.tag.TagAttributeException: /jetty470.xhtml @16,34 test="${not empty errors}" /jetty470.xhtml @16,34 test="${not empty errors}": ELResolver cannot handle a null base Object with identifier 'errors' at com.sun.facelets.tag.TagAttribute.getObject(TagAttribute.java:235) at com.sun.facelets.tag.TagAttribute.getBoolean(TagAttribute.java:79) at com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:49) at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49) at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25) at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95) at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:509) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:552) at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101) at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75) at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.appfuse.webapp.filter.MessageFilter.doFilter(MessageFilter.java:46) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: