Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4510

org.zkoss.zel.ELException: Unable to find ExpressionFactory of type: # Licensed to the Apache Software ...

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.0
    • 8.0.5
    • Container
    • Security Level: Jimmy
    • tomcat >=7.0.100
      tomcat >=8.5.51
      tomcat >=9.0.31

      error doesn't happen since zk 8.5

      Steps to Reproduce

      display any EL in a zul file:

      <zk>
         ${desktop.id}
      </zk>
      

      Current Result

      org.zkoss.zel.ELException: Unable to find ExpressionFactory of type: # Licensed to the Apache Software Foundation (ASF) under one or more
      	org.zkoss.zel.ExpressionFactory.newInstance(ExpressionFactory.java:167)
      	org.zkoss.zel.ExpressionFactory.newInstance(ExpressionFactory.java:106)
      	org.zkoss.zel.Util.getExpressionFactory(Util.java:126)
      	org.zkoss.zel.ELManager.getExpressionFactory(ELManager.java:30)
      	org.zkoss.zel.ELContext.convertToType(ELContext.java:306)
      	org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      	org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:41)
      	org.zkoss.zk.xel.impl.SimpleEvaluator.evaluate(SimpleEvaluator.java:68)
      	org.zkoss.zk.ui.metainfo.AbstractEvalRef.evaluate(AbstractEvalRef.java:46)
      	org.zkoss.zk.xel.ExValue.getValue(ExValue.java:111)
      	org.zkoss.zk.ui.metainfo.Property.getValue(Property.java:138)
      	org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:234)
      	org.zkoss.zk.ui.metainfo.Property.assign(Property.java:174)
      	org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:742)
      	org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:146)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:919)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:889)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:776)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:836)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:794)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
      	org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
      	org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      Root Cause
      
      java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more
      	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
      	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
      	org.zkoss.zel.ExpressionFactory.newInstance(ExpressionFactory.java:160)
      	org.zkoss.zel.ExpressionFactory.newInstance(ExpressionFactory.java:106)
      	org.zkoss.zel.Util.getExpressionFactory(Util.java:126)
      	org.zkoss.zel.ELManager.getExpressionFactory(ELManager.java:30)
      	org.zkoss.zel.ELContext.convertToType(ELContext.java:306)
      	org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      	org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:41)
      	org.zkoss.zk.xel.impl.SimpleEvaluator.evaluate(SimpleEvaluator.java:68)
      	org.zkoss.zk.ui.metainfo.AbstractEvalRef.evaluate(AbstractEvalRef.java:46)
      	org.zkoss.zk.xel.ExValue.getValue(ExValue.java:111)
      	org.zkoss.zk.ui.metainfo.Property.getValue(Property.java:138)
      	org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:234)
      	org.zkoss.zk.ui.metainfo.Property.assign(Property.java:174)
      	org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:742)
      	org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:146)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:919)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:889)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:776)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:836)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:794)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
      	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
      	org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
      	org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      

      Expected Result

      no error

      Debug Information

      related tomcat issue: https://bz.apache.org/bugzilla/show_bug.cgi?id=64097

      in 8.0.5:
      The method org.zkoss.zel.ExpressionFactory#getClassNameServices reads the service config file (META-INF/services/javax.el.ExpressionFactory)
      and fails to ignore comments after a '#'.
      instead it simply returns the first non empty line it finds (in the error case a license comment)

      https://github.com/zkoss/zk/blob/v8.0.5/zel/src/org/zkoss/zel/ExpressionFactory.java#L411-L421

      Workaround

      create a file (e.g. in a standard maven war project)
      src/main/resources/META-INF/services/javax.el.ExpressionFactory

      with the content:

      org.zkoss.zel.impl.ExpressionFactoryImpl
      

            Unassigned Unassigned
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: