0

Getting following exception when adding composite component programmatically

java.lang.NullPointerException: null
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:220) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:938) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:605) ~[javax.faces.jar:2.1.6-SNAPSHOT]
    at org.omnifaces.util.Components.includeCompositeComponent(Components.java:320) ~[omnifaces-1.6.jar:1.6]

Components.includeCompositeComponent(form,
        "ccomp", "ccomponent.xhtml", "ccomponentId");

NPE does not appear when javax.faces.PARTIAL_STATE_SAVING = true. But when true, getting duplicate id errors in other places.

How to resolve this?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user3516088
  • 155
  • 2
  • 11
  • The full stack trace and/or a MCVE would be helpful to see the culprit. And, if you can, trying latest Mojarra too. Version 2.1.6 is more than 3 years old already. – BalusC Jan 13 '15 at 13:05

1 Answers1

0

You may do it in a wrong phase. Try doing that in the postAddToView phase.

List of JSF 2 events?

Community
  • 1
  • 1
Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76