JSPG0122E: Unable to parse EL function in Websphere 8
Asked Answered
G

2

3

I am moving a web application from Websphere 6.1 to Websphere 8, and I am encountering the following error in one of my JSP pages:

com.ibm.ws.jsp.translator.JspTranslationException: JSPG0227E: Exception caught while translating /jsp/myJsp.jsp: /jsp/myJsp.jsp(863,4) --> JSPG0122E: Unable to parse EL function ${not empty rowVo.operation.package}. at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateElFunction(ELValidator.java:500) at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:122) at com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateELExpression(ELValidator.java:149) at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttribute(ValidateVisitor.java:1757) at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.validateCustomTagAttributeValues(ValidateVisitor.java:1405) at com.ibm.ws.jsp.translator.visitor.validator.ValidateVisitor.visitCustomTagStart(ValidateVisitor.java:294) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:366) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:369) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processChildren(JspVisitor.java:419) at com.ibm.ws.jsp.translator.visitor.JspVisitor.processJspElement(JspVisitor.java:234) at com.ibm.ws.jsp.translator.visitor.JspVisitor.visit(JspVisitor.java:216) at com.ibm.ws.jsp.translator.JspTranslator.processVisitors(JspTranslator.java:127) at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:254) at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:121)

The offending section in the JSP file looks like this:

<c:forEach var="rowVo"
  items="${searchResultContainer.searchResultRowsPage}"
  varStatus="opStatus">
    <c:if test="${not empty rowVo.operation.jobscopeDescription}">
        <td>${rowVo.operation.jobscopeDescription}</td>
    </c:if>
    <c:if test="${not empty rowVo.operation.package}">
        <td>${rowVo.operation.package}</td>
    </c:if>
</c:forEach>

What is really confusing me is that the exception is thrown from the third EL expression, when the second is almost identical.

Operation is a generated class:

public class Operation {

    //Other properties omitted

    @XmlElement(name = "package")
    protected List<Package> _package;
    protected List<String> jobscopeDescription;
    public List<Package> getPackage() {
        if (_package == null) {
            _package = new ArrayList<Package>();
        }
        return this._package;
    }    
    public List<String> getJobscopeDescription() {
        if (jobscopeDescription == null) {
            jobscopeDescription = new ArrayList<String>();
        }
        return this.jobscopeDescription;
    }
}

These files have not changed during the migration, and worked fine on WAS 6.1. Does anyone have a clue what is wrong here?

Goshen answered 19/7, 2013 at 10:41 Comment(0)
S
6

The code responsible for checking for the use of reserved keywords as EL variable identifiers was enhanced in WebSphere Application Server v8.0 and beyond, making the checking more strict. The variable checking code not only checks for reserved EL keywords, but also Java reserved keywords.

See this article for more info: http://www-01.ibm.com/support/docview.wss?uid=swg21642419&myns=swgws&mynp=OCSSEQTP&mync=A

Smote answered 19/7, 2013 at 20:8 Comment(2)
Ah, perfect. I was looking for something like this to explain it, but couldn't find anything. Thank you!Goshen
Nice! +1. Things like these are really hard to find with IBM products.Almatadema
G
1

It seems this error was due to Websphere 8 not being able to parse EL expressions containing a package property or variable. For example, changing the above to

<c:if test="${not empty rowVo.operation.getPackage()}">

made it work.

I also made a little test of my theory with this little snippet:

<c:set var="salary" scope="session" value="${2000*2}"/>
<c:out value="Salary: ${salary}"/>

runs fine and produces the expected output Salary: 4000. However,

<c:set var="package" scope="session" value="${2000*2}"/>
<c:out value="Salary: ${package}"/>

produces the same error as above.

Goshen answered 19/7, 2013 at 11:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.