Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax.el.ELException: Function "rich:element" not found

Tags:

jsf

el

richfaces

Moved from Kubuntu to OS X (bought macbook). Set up environment to build my project with the following (downloaded from official websites, not the repositories):

  • Java SE (build 1.7.0_60-b19)
  • Apache Maven 3.2.1
  • Apache Tomcat 7.054

Project technology stack:

  • Spring Framework 3.2.2.RELEASE
  • Hibernate 4.2.5.Final
  • Java Server Faces 2.2.0
  • RichFaces 4.3.1.Final
  • MySQL 5.6.19

Build with maven goes ok on Windows 7, Kubuntu 14.04 and Mac OS X Mavericks 10.9.3. Deployment onto Apache Tomcat 7 goes ok too (no errors, warnings appear). Once project is deployed, going to login screen, loading the main page, surfing through project views until I get to an Invoices page, that contain #{rich:element('some_id')}.some_action(). Rendering this page falls with error below:

    ERROR com.skeds.core.component.exceptions.SkedsCustomExceptionHandler Function 'rich:element' not found
    javax.el.ELException: Function 'rich:element' not found
    at org.jboss.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:176)
    at org.jboss.el.parser.SimpleNode.accept(SimpleNode.java:129)
    at org.jboss.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:138)
    at org.jboss.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:152)
    at org.jboss.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:195)
    at org.jboss.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68)
    at com.sun.faces.facelets.el.ELText$ELTextVariable.apply(ELText.java:203)
    at com.sun.faces.facelets.el.ELText$ELTextComposite.apply(ELText.java:184)
    at com.sun.faces.facelets.compiler.TextInstruction.apply(TextInstruction.java:96)
    at com.sun.faces.facelets.compiler.UIInstructionHandler.apply(UIInstructionHandler.java:141)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)

I can go to one of another pages and sometimes can render Invoices page without this error, but still clicking on some another page with this EL gives the same error.

What was tried:

  1. Deployed on different Tomcat versions (7.054, 7.050, 7.053).
  2. Built with different Maven versions (3.2.1, 2.0.4).
  3. Was using different Java SDK versions (1.6, 1.7, 1.8).
  4. During code investigation found the following dependency fail at the org.richfaces.function.RichFunction class:

    import org.richfaces.cdk.annotations.Function;
    

    Which is the most likely reason of an error. Added the following dependency to my pom.xml:

    <dependency>
        <groupId>org.richfaces.cdk</groupId>
        <artifactId>annotations</artifactId>
        <version>4.3.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    

    The IDE precompiler shows that dependency is resolved. mvn clean install and redeployment of a project gives no results. The same error appear.

  5. While googling the possible solutions - saw the issue with el-api.jdk within some of the package in the project classpath. At the tomcat7 lib directory there is one el-api.jdk, at the pom.xml there are three exclusions on the dependencies that possibly can contain el-api.jdk that can conflict. Also at the target/WEB-INF/lib directory there are no el-api.jdk files that can conflict too.
  6. Opened project in Google Chrome and OS X Safari - the last one gives less errors, but they are still present.
  7. Cloned project from Git three times, did the full-install instructions, built and ran both from IDE Intellij IDEA 13 (latest update) and from terminal - copied .war to /webapps and ran catalina.sh. Also tried with mvn package -DskipTests jetty:run - all options give the same result.

EDIT: Problem appeared on kubuntu 14.04 and ubuntu 12.10. Also tested on Windows 7 - the same issue. So this is not an OS based error.

Any suggestions will be MUCH appreciated.

like image 869
NoiseDN Avatar asked Dec 02 '25 02:12

NoiseDN


1 Answers

Resolved. As it is always happened, the cause of an issue was totally stupid. Intellij IDEA has an option to auto-clean unused namespaces on JSF .xhtml views. The Invoices page contain an include that has #{rich:element('some_id')} within, but Rich Function is not an actual namespace usage, which is for instance a tagname <rich:calendar>. That is why Idea cleaned it on one of project's rebuilds. A namespace xmlns:rich="http://richfaces.org/rich" was defined only in the outer invoices.xhtml. And rendering the inner include without declared namespace cause the RestoreView phase to crash with the given error.

like image 93
NoiseDN Avatar answered Dec 04 '25 05:12

NoiseDN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!