When you create a new NetBeans JSF project you will want to use Contexts and Dependency Injection (CDI). Unfortunately there is a defect in the 8.0 versions of NetBeans. It does not automatically add a beans.xml configuration file. This causes problems when you create new JSF managed beans. This problems can be avoided by manually adding the file before you create them.

First check to see if the file is missing by expanding the "Web Pages/WEB-INF" item in the project as shown below. If there is a file beans.xml then you do not need to add it. If it is missing it can be added with the following steps.

  1. In the Projects pane, right click on anywhere in the project.
  2. In the popup menu click on New. This will bring up a submenu. Click on "Other...". This will bring up the "New File" wizard.

Menu

The "New File" wizard has two steps:

  1. Choose File Type, and
  2. Name and Location.

The defaults here are correct.

  1. Click on Finish.

Name and Location Dialog

The defaults here are correct.

  1. Choose "Contexts and Dependencies Injection" in the "Categories:" pane.
  2. Choose "beans.xml (CDI Configuration File)" in the "File Types:" pane.
  3. Click on Next >.

Choose File Type Dialog

After a few seconds the beans.xml file should appear.

Done