Saturday, September 14, 2013

JSF Errors: JSF1006: Cannot instantiate converter of type ..

JSF1006 error is one of less common. The error can be thrown when JSF Application object tries to create new Converter. To create a Converter, the framework uses the method createConverter. Exception could be thrown when specified Converter can not be found, primarily when Converter Id Map (contained by Application object) doesn't contain it:

public Converter createConverter(String converterId)
   {
     Util.notNull("converterId", converterId);
     Converter returnVal = (Converter)newThing(converterId, this.converterIdMap);
     if (returnVal == null) {
       Object[] params = { converterId };
       if (LOGGER.isLoggable(Level.SEVERE)) {
         LOGGER.log(Level.SEVERE, "jsf.cannot_instantiate_converter_error", converterId);

       // !!! The error will be thrown here.

       etc..

In the Mojarra implementation, if the Converter cannot be find, additional exception message can be logged: Expression Error: Named Object: 'your_converter_name' not found
When Converter object cannot be created for other reasons then will be thrown:
  • AssertionError
  • FacesException with message "Cannot instantiate class"
  • Under certain conditions another FacesMessage form methods com.sun.faces.Application.newThing or com.sun.faces.util.Util.loadClass

No comments:

Post a Comment