5 Replies Latest reply on May 20, 2017 11:21 PM by jamezp

    Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.

    chupacabras

      I am using Wildfly 10.1.0 Final, I have added Richfaces module:

      <module xmlns="urn:jboss:module:1.3" name="org.richfaces">
          <resources>
              <resource-root path="atmosphere-runtime-2.4.3.jar"/>
              <resource-root path="cssparser-0.9.18.jar"/>
              <resource-root path="guava-19.0.jar"/>
              <resource-root path="richfaces-a4j-4.5.17.Final.jar"/>
              <resource-root path="richfaces-core-4.5.17.Final.jar"/>
              <resource-root path="richfaces-rich-4.5.17.Final.jar"/>
              <resource-root path="richfaces-page-fragments-4.5.17.Final.jar"/>
              <resource-root path="sac-1.3.jar"/>
          </resources>
          <dependencies>
              <module name="com.sun.jsf-impl" />
              <module name="javaee.api" />
              <module name="javax.faces.api" />
              <module name="org.slf4j" />
          </dependencies>
      </module>
      

       

      I have deployed 1 web application, which does not contain any jar related to JSF or Richfaces.

      Dependencies in this web application are set to:

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <deployment>
              <dependencies>
                  <module name="org.hibernate" slot="main" />
                  <module name="org.javassist" slot="main" />
                  <module name="javax.mail.api" slot="main" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

       

      Log contains many warnings:

      2017-05-15 10:41:53,740 WARNING [javax.faces] (default task-107) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.

       

      How to solve this problem?

      I am not aware of multiple JSF applications in Wildfly.

        • 1. Re: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
          jamezp

          I'm not certain this is the issue, but maybe try removing the com.sun.jsf-impl module. You should only need the javax.faces.api.

           

          --

          James R. Perkins

          • 2. Re: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            chupacabras

            I have removed "com.sun.jsf-impl" dependency from Richfaces module.

            It did not help.

            I still receive tons of this line:

            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-124) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-3) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-126) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-122) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-128) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,666 WARNING [javax.faces] (default task-118) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,682 WARNING [javax.faces] (default task-1) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,682 WARNING [javax.faces] (default task-5) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            2017-05-18 09:42:17,682 WARNING [javax.faces] (default task-127) Multiple JSF Applications found on same ClassLoader.  Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
            

             

            It is being generated by this code:

            FacesContextFactory contextFactory=(FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
            LifecycleFactory lifecycleFactory=(LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
            Lifecycle lifecycle=lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
            

             

            Every line throws that warning to the log.

            • 3. Re: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
              jamezp

              The only thing I can think of would be to double check your deployment to ensure there are no JSF libraries in your deployment. I'm not sure why else it would see multiple implementations on the class path.

               

              --

              James R. Perkins

              • 4. Re: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
                chupacabras

                I see two options:

                1. I have multiple JSF implementations in my classpath

                2. there is some bug in WildFly (or somewhere else)

                 

                I checked it, I have no JSF implementation inside my WAR files. WildFly has Mojarra module (com.sun.jsf-impl), and I added Richfaces module (as described in my original post, removed "com.sun.jsf-impl" from dependencies in Richfaces).

                My WAR application has dependency for Richfaces, not Mojarra.

                 

                Is there a way how to verify whether there are multiple JSF implementations on the class path?

                • 5. Re: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match.
                  jamezp

                  I'm not sure what it could be. Maybe if you look at the class path with JConsole or a profiler of some sort. You could turn on trace logging for org.jboss.modules, but it will be very verbose.

                   

                  --

                  James R. Perkins