Search code examples
jsfweblogic12c

WebLogic 12.2.1.4 JSF 1.2 ELContext provokes null pointer on literal expressions


Jsf page with myFaces trinidad 1.2.15 ver JSF 1.2-20 could not be parsed due to expression evaluation error over ELContext. here is the stack

Caused by: java.lang.NullPointerException
 at com.sun.el.ValueExpressionLiteral.getValue(ValueExpressionLiteral.java:79)
 at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperty(UIXComponentELTag.java:135)
 at org.apache.myfaces.trinidadinternal.taglib.html.HtmlHeadTag.setProperties(HtmlHeadTag.java:70)
 at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperties(UIXComponentELTag.java:122)
 at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:230)
 at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:513)
 at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:782)
 at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)
 at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)
 at jsp_servlet._jsp._btwizard.__btwizardmain._jsp__tag2(__btwizardmain.java:648) ....

Solution

  • The problem was that the setProperty method of UIXComponentELTag by default passes a null argument for ElContext as this:

    bean.setProperty(key, expression.getValue(null));
    

    This is not supported on the version of elcontext that weblogic12 uses. We were not allowed to change the version of trinidad being used so we had to patch the library changing all the calls of getValue with

    bean.setProperty(key, expression.getValue(FacesContext.getCurrentInstance().getELContext()));
    

    We also found this problem on some clases that were generated from XML files like Color.xml, DateTime.xml and Number.xml, so we had to prevent them from being generated and provide our own implementation.