public MockFacesContextFactory() {

        Class clazz = null;

        // Try to load the 1.2 version of our mock FacesContext class
        try {
            clazz = this.getClass().getClassLoader().loadClass("org.apache.shale.test.mock.MockFacesContext12");
            constructor = clazz.getConstructor(facesContextSignature);
            jsf12 = true;
        } catch (NoClassDefFoundError e) {
            // We are not running on JSF 1.2, so go to our fallback
            clazz = null;
            constructor = null;
        } catch (ClassNotFoundException e) {
            // Same as above
            clazz = null;
            constructor = null;
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new FacesException(e);
        }

        // Fall back to the 1.1 version if we could not load the 1.2 version
        try {
            if (clazz == null) {
                clazz = this.getClass().getClassLoader().loadClass("org.apache.shale.test.mock.MockFacesContext");
                constructor = clazz.getConstructor(facesContextSignature);
                jsf12 = false;
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new FacesException(e);
        }

    }