When you create a NetBeans JSF project from existing source and the project sources use Contexts and Dependency Injection (CDI), NetBeans indicates that the source code has errors as shown below.

Choose Project Dialog Choose Project Dialog

The errors are due to a bug in the 8.0 versions of NetBeans. It does not include a critical library, cdi-api.jar, when it searches for import sources. This problem can be fixed by manually adding the library with the following steps.

  1. In the Projects pane, right click on Libraries.
  2. In the popup menu click on Add Jar/Folder.

Libraries Menu

  1. Use the folder combo box (together with the Folders pane if necessary) to navigate to the folder containing cdi-api.jar.
  2. Select cdi-api.jar.
  3. Click on Next>.

Add Jar/Folder Dialog

A few seconds after adding the cdi-api.jar library the error indications should disappear.

Choose Project Dialog