Several versions of the required javax.faces.FactoryFinder class were found.

I started work on JSF2.0. I followed the tutorial without any problems and everything worked perfectly! I used Eclipse Helios. But I noticed something that I do not understand. The tutorial says to add Project Facet for JSF 2. I did not do this, and everything worked fine. Therefore, to follow the instructions, I did this:

Right click on Project -> Properties -> Fac Facets

The JavaServer Faces checkbox was not checked. I guess this is what the tutorial means Project Facet. I clicked on him and

Additional configuration

Link appeared

. I followed the link to the JSF dialog (Modify Faceted Project), which I selected as a user library, my JSF library (this is MyFaces), but I received an error message:

Several versions of the required javax.faces.FactoryFinder class were found.

What is this mistake? Can I add a project facet after creating my project? And why is a project facet needed? My (trivial) code indicates that JSF is working fine, so why do I need a Facet project?

+4
source share
3 answers

In Eclipse help :

Boundaries define the characteristics and requirements of Java EE projects and are used as part of the configuration runtime.

When you add a facet to a project, this project is configured to perform a specific task, to fulfill certain requirements or characteristics. For example, an EAR facet creates a project for an enterprise application by adding a deployment descriptor and setting the path to the project class.

In the case of the JSF facet :

The following functions are available when the JSF facet is installed:

  • JSF library configuration support.
  • Application Configuration Management
  • Semantic validation and JSP content support for the main part of the JSF Core tag library and JSF HTML attribute values ​​using the expression Language (EL) or not.
  • Support "Run on Server" JSP JSP page

In case of this error:

Several versions of the required javax.faces.FactoryFinder class were found.

It seems that the tool has detected several copies of the main JSF API in the path of the project. JSF has some tolerance for this and historically supported the launch of various versions in different contexts of the class loader, that is, you can put it in a WAR and one in a container. Using the Open Type dialog ( CTRL + SHIFT + T ) and searching for javax.faces.FactoryFinder should help you find the criminal banner.

+3
source

Adding JSF nature / facet to your project adds features like code completion, adding jsf visual components to your web page editor, etc. into your project. Check the build patch and see how many jsf api jars there are. I assume that this error is in the IDE and not in the running application.

+2
source

The JSF snippet helps you customize your project using JSF libraries. It also allows you to collect specific JSF checks and tools from the JSF Tools project. Although it is of course possible to develop a JSF application without using the JSF tools, as you did, you can be more productive if you use these tools.

If you are interested in testing JSF tools with your tutorial, start by creating a new web project with a JSF facet. Then skip the parts of your tutorial that talk about setting up libraries or creating descriptors.

0
source

Source: https://habr.com/ru/post/1333382/


All Articles