Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3234

Wrong JSF class loaded in third dependencies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Critical Critical
    • None
    • 8.0.0.Final, 8.1.0.CR1
    • JSF

      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

              fjuma1@redhat.com Farah Juma
              janarioliver@gmail.com Janario Oliveira (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: