JSPG0122E: Unable to parse EL function in Websphere 8

独自空忆成欢 提交于 2019-12-01 23:32:33

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/17744158/jspg0122e-unable-to-parse-el-function-in-websphere-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!