MyFaces Core
  1. MyFaces Core
  2. MYFACES-2442

Problem when using MyFaces with Spring DM within an OSGi environment

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      Spring 2.5.6, Spring DM 1.2.0, Tomcat 6.20, MyFaces 1.2.2, Equinox 3.5
      Servlet HTTP 2.5, JSP 2.1

      Description

      Hello,

      We detect a problem when using MyFaces 1.2.2 within an OSGi container. The problem occurs when MyFaces tryies to initialize the default JspFactory from the Jsp21FacesInitializer class. It seems that the code which poses problem is the following:

      if (jspFactory == null) {
      // TODO: this Class.forName will be removed when Tomcat fixes a bug
      // also, we should then be able to remove jasper.jar from the deployment
      try

      { Class.forName("org.apache.jasper.compiler.JspRuntimeContext"); }

      catch (ClassNotFoundException e)

      { ; // ignore }

      catch (Exception ex)

      { log.debug("An unexpected exception occured " + "while loading the JspRuntimeContext.", ex); }

      jspFactory = JspFactory.getDefaultFactory();
      }

      As a matter of fact, the getDefaultFactory method returns null in this context...

      If we force MyFaces to use the Jsp20FacesInitializer class from the ContainerUtils class as following:

      public class ContainerUtils

      {

      /**

      • Determines whether we're running in a Servlet 2.5/JSP 2.1 environment.
      • @return <code>true</code> if we're running in a JSP 2.1 environment,
      • <code>false</code> otherwise

      */

      public static boolean isJsp21()

      {

      /*try

      { // simply check if the class JspApplicationContext is available Class.forName("javax.servlet.jsp.JspApplicationContext"); return true; }

      catch (ClassNotFoundException ex)

      { ; // expected exception in a JSP 2.0 (or less) environment }

      */

      return false;

      }

      (...)
      }

      the problem doesn't occur and MyFaces can be used.

      Regards,
      Thierry

        Issue Links

          Activity

          Hide
          Leonardo Uribe added a comment -

          On latest myfaces core impl code we have this package as imported:

          org.apache.jasper.compiler;resolution:=optional

          this solves the problem you describe, so I'll close this one as duplicate. Thanks for your report.

          Show
          Leonardo Uribe added a comment - On latest myfaces core impl code we have this package as imported: org.apache.jasper.compiler;resolution:=optional this solves the problem you describe, so I'll close this one as duplicate. Thanks for your report.
          Hide
          Leonardo Uribe added a comment -

          fixed on MYFACES-2290

          Show
          Leonardo Uribe added a comment - fixed on MYFACES-2290

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Thierry Templier
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development