Problem when using MyFaces with Spring DM within an OSGi environment --------------------------------------------------------------------
Key: MYFACES-2442 URL: https://issues.apache.org/jira/browse/MYFACES-2442 Project: MyFaces Core Issue Type: Bug Components: General Affects Versions: 1.2.2 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 Reporter: Thierry Templier 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 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.