0 Replies Latest reply on Jul 28, 2010 11:55 AM by speleomaniac

    Classloading problem with org.apache.el.lang.FunctionMapperImpl

    speleomaniac

      Hi everybody,

       

      I am having big problems with FunctionMapperImpl class inside of the jbossweb.jar...

       

      I am trying to use the jboss-el in from my web applications WEB-INF/lib directory, actually I am able to use the functionality from jboss-el, my problem starts when I try to use a Facelet Function (fn:length).....

       

      The web application complains that it can find the fn:length function but facelet.jar is also in the WEB-INF/lib directory, after long debuging hours, I figure out that JSF and Facelet uses org.apache.el.lang.FunctionMapperImpl class instead of org.jboss.el.lang.FunctionMapperImpl while org.apache.el.lang.FunctionMapperImpl is in the jbossweb.jar, Unified Class Loader is trying to locate the JstlFunction from the org.apache.el.lang.FunctionMapperImpl classloader with the following code....

       

      public Method getMethod() {
                  if (this.m == null) {
                      try {
                          Class t = Class.forName(this.owner);
                          Class[] p = ReflectionUtil.toTypeArray(this.types);
                          this.m = t.getMethod(this.name, p);
                      } catch (Exception e) {
                          throw new RuntimeException("Error loading function", e);
                      }
                  }
                  return this.m;
              }

       

      As you may see the Class t = Class.forName(this.owner), ist guilty part here, org.apache.el.lang.FunctionMapperImpl is from UnifiedClassLoader loaded, not from WebApplication ClassLoader but com.sun.facelets.tag.jstl.fn.JstlFunction is from WebApplication ClassLoader loaded, so I got a ClassNotFoundException from there....

       

      I try to turn off Java2 Class Loading compliance in jboss-web.xml without success, because of jbossweb.jar is there, org.apache.el.lang.FunctionMapperImpl is also there....

       

      I think correct code should evolve around Thread.currentThread().getContextClassLoader()  in the getMethod ,so the Web Application Class Loader is used to find JstlFunction

       

      But I am running out of ideas, any solution proposals, please

       

      Thx in advance