Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2442

Problem when using MyFaces with Spring DM within an OSGi environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.2.2
    • None
    • General
    • None
    • 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

      Attachments

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              templth Thierry Templier
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: