I have a web project, war, who use a third maven dependency which load java ee 6 dependency with provided scope:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
In runtime the third dependency tries to load a FaceletContext and to ensure compatibility it uses the constant from javax.faces.view.facelets.FaceletContext.FACELET_CONTEXT_KEY which fails because the constant returns the old constant from java ee 6 version, com.sun.faces.facelets.FACELET_CONTEXT instead of javax.faces.FACELET_CONTEXT from java ee 7.
If I try the same code from a class in war project it loads the right constant and works.
E.g.
public FaceletContext getFaceletContext() {
final FacesContext currentInstance = FacesContext.getCurrentInstance();
return (FaceletContext) currentInstance.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
//from third dependency "com.sun.faces.facelets.FACELET_CONTEXT"
//from classes in war "javax.faces.FACELET_CONTEXT"
}
I've created it with critical priority because it broke compatibility with some jsf frameworks.
Attached the project where I could simulate