javax.faces.FacesException: Expression Error: Name

2019-08-11 06:09发布

问题:

I am trying to test a JSF 2.2 project with BootsFaces 0.7. The project is running like a charm on GlassFish 3 and PrimeFaces 5.2. But on the page where any tag is used from the BootsFaces libraray, like <b:well>, I get the following exception:

javax.faces.FacesException: Expression Error: Named Object: net.bootsfaces.layout.Well not found

How is this caused and how can I solve it?

回答1:

Thanks to this answer , I finally found the solution to my issue: I had to put the boots faces jar file in the /WEB-INF/lib directory. I will never get tired of saying it: Many thanks BalusC



回答2:

Update Oct 05, 2015: If you happen to use Spring Boot and Mojarra, go back to Mojarra 2.2.10. The newer versions are broken, and they will remain broken until the Spring Boot ticket https://github.com/spring-projects/spring-boot/issues/3216 is resolved. Alternatively, you may try Apache MyFaces, as described in http://www.beyondjava.net/blog/newsflash-running-example-of-spring-boot-jsf/.

The error message means the the class net.bootsfaces.layout.Well cannot be created. You didn't give the rest of the stack trace, but most likely the error is raised in a method called newThing(). This is weird, because JSF already figured out that b:well is implemented by net.bootsfaces.layout.Well. In other words: JSF managed to read the configuration file, but fails to create the object. My best guess is there's something wrong with your classpath, or that you've got a corrupt BootsFaces.jar.

I suggest you try to execute the line new net.bootsfaces.layout.Well() for a test. If my theory is correct, it should result in a ClassNotFoundException.

Another possibility is your runtime environment. Do you use Spring Boot? This theory has been uttered by a brazilian developer. Maybe this causes the error.

In the meantime, there are two tickets on our bug tracker: https://github.com/TheCoder4eu/BootsFaces-OSP/issues/188 and https://github.com/TheCoder4eu/BootsFaces-OSP/issues/189.