1

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?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Hicham
  • 170
  • 2
  • 16
  • Could you please translate the error messages? – Kyll Sep 26 '15 at 16:18
  • object named "net.bootsfaces.layout.Well" not detected – Ortomala Lokni Sep 26 '15 at 16:20
  • Do you have a `metadata-complete="true"` in webapp's `web.xml`? As to localized errors, please change your development environment to English. When copypasting an English error message into a search engine, you will get so much more clues back. – BalusC Sep 26 '15 at 16:34
  • Any suggestion how to localize errors (in English) in NetBeans and glassfish 3? – Hicham Sep 26 '15 at 16:43
  • Basically, you need to add `-Duser.language=en -Duser.country=US` as VM arguments of the JRE used by Netbeans. No idea where exactly to configure it in Netbeans as I don't use Netbeans. – BalusC Sep 26 '15 at 17:00
  • Most of logs are in English but this one is in French!!! I added -Duser.language=en -Duser.country=US to VM but still get this error logged in French!!! – Hicham Sep 26 '15 at 17:41
  • The error message is shown when `new net.bootsfaces.layout.Well()` fails. Did you already check whether the class `net.bootsfaces.layout.Well` is on your classpath? Maybe you've got a corrupt version of the BootsFaces library? – Stephan Rauh Sep 27 '15 at 10:07
  • It seems that my hint was missed/overlooked/ignored, I'll repeat it once again: Do you have a `metadata-complete="true"` in webapp's `web.xml`? – BalusC Sep 28 '15 at 08:22
  • with metadata-complete="true" the following error message is thrown Grave: Exception while preparing the app: Unable to load the EJB moduleDeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for D:\Projets\myproject\build\web If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used,please make sure that the deployment descriptor references a Java EE5 or higher version schema, and that the metadata-complete attribute is not set to true,so the component annotations can be processed as expected – Hicham Sep 28 '15 at 08:41
  • OK, you didn't have that. That's good. It's namely one of probable causes for this. – BalusC Oct 02 '15 at 20:49

2 Answers2

3

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

Community
  • 1
  • 1
Hicham
  • 170
  • 2
  • 16
  • Oops - it just didn't cross my mind you might try without BootsFaces.jar in the /WEB-INF/lib folder :). I'll add that to my list of standard remedies. Thanks for reporting back! – Stephan Rauh Nov 10 '15 at 21:44
  • But still strange for me because I had always primefaces and in the past richfaces in /domain/lib and not /WEB-INF/lib and everything was running perfectly. What have changed with this bootsfaces library? – Hicham Nov 10 '15 at 21:50
  • Ah, I see. I always use Tomcat, so I wasn't aware of the /domain/lib folder. Actually, there's no technical difference between the way PrimeFaces and BootsFaces are initialized (at least no difference I'm aware of). Maybe the answer is very simple: most application servers load their libraries in alphabetical order. So BootsFaces is loaded before Mojarra or MyFaces, which is loaded before PrimeFaces and RichFaces. But that's just a wild shot. Now that I know you're using Glassfish, we can test BootsFaces compatibility with Glassfish. Thanks for the hint! – Stephan Rauh Nov 11 '15 at 22:44
1

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.

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37
  • Thank you for your suggestion. new net.bootsfaces.layout.Well() didn’t throw any Exception, and the first part of the stack trace is: Grave: JSF1068 : Impossible d’instancier un composant dont le type est net.bootsfaces.layout.Well Grave: Critical Exception! javax.faces.FacesException: Erreur d’expression : objet nommé «net.bootsfaces.layout.Well» non détecté at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1912) at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1166) – Hicham Sep 27 '15 at 21:08
  • Which is to say that newThing() has been called, but returns null. Bon, c´est vrai, c´est un error grave. At the moment, I'm puzzled. What happens if you try one of my demo projects at https://github.com/stephanrauh/BootsFaces-Examples? For instance, https://github.com/stephanrauh/BootsFaces-Examples/tree/master/ModalDialogs? – Stephan Rauh Sep 28 '15 at 21:36
  • Maybe the error is caused by your runtime environment - possibly Spring Boot? – Stephan Rauh Oct 02 '15 at 20:48
  • Great article there, Stephan! It definitely helped in understanding the misbehavior. An OmniFaces user has reported a very similar issue here: http://stackoverflow.com/questions/32327848/named-object-resource-include-not-found-omnifaces-jsf-2-2-12 – BalusC Oct 08 '15 at 07:36