Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-2758

Initial fixture scripts can fail to load due to JSF not present exception.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M5
    • Fix Version/s: 2.0.0-M6
    • Component/s: Isis Core
    • Labels:
      None

      Description

      stack trace due to: ExceptionInInitializerError 

      "java.util.MissingResourceException: Can't find javax.faces.LogStrings bundle from"

      where call to currentUserName() brings in ImpersonatedUserHolder and ultimately its proxy results in going down a code path to attempt to bring in JSF:

      public abstract class RequestContextHolder {
         private static final boolean jsfPresent =    
             ClassUtils.isPresent("javax.faces.context.FacesContext",
                                  RequestContextHolder.class.getClassLoader());
        

      this class is part of 

      <dependency>
          <groupId>javax</groupId>
          <artifactId>javaee-api</artifactId>
      </dependency>
        

      referenced by both isis-commons and isis-applib.

      UPDATE:

      first attempt to solve this was to exclude the JSF classes.  However, as they are part of the overall javaee-api jar file (for JavaEE v8), this is suprisingly difficult to do ... that is not a simple aggregator of the respective specs in the JavaEE.  And that approach increases the maintenance effort.

      And in any case, it just moved the exception but didn't completely resolve it ... the exception was being thrown in a static initializer of a proxy for `ImpersonatedUserHolderWithSession`, as this latter class is annotated as `@RequestScoped` but was called outside of an http request.

      The fix I've used is to remove that annotation and instead to use RequestContextHolder that can check if there's a thread-local that contains an HttpRequest.  This allows us to keep the dependency on javaee-api.

        Attachments

          Activity

            People

            • Assignee:
              danhaywood Daniel Keir Haywood
              Reporter:
              danhaywood Daniel Keir Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: