I\'m trying to migrate simple JSF2.2 prototype from Mojarra 2.2.5 (... where works fine ...) to MyFaces 2.2.3 but a NullPointerEx
It is not a bug. Use FaceletContext is the wrong way to do it, because later it causes duplicate id and state management issues, that does not have solution because from start the code is wrong. Instead, try use this way:
ViewDeclarationLanguage vdl = facesContext.getApplication().
getViewHandler().getViewDeclarationLanguage(
facesContext, facesContext.getViewRoot().getViewId());
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("src", "/addSimpleIncludeVDL_1_1.xhtml");
UIComponent component = vdl.createComponent(facesContext,
"http://java.sun.com/jsf/facelets",
"include", attributes);
getChildren().add(component);
vdl.createComponent(...) was added in JSF 2.2, and in MyFaces it was improved to allow this usage. You can even add composite components programmatically in this way. In MyFaces users list it has been reported that this way works very well.