1 Reply Latest reply on Apr 4, 2013 9:51 AM by Marek Schmidt

    Problem when using Seam 2.3.0 and Openfaces 3.0 together

    Michael Esmann Newbie

      Hi,

       

      I am trying to use Seam 2.3.0 together with Openfaces 3.0. When I use these two modules together and try to deploy my application on JBoss AS 7.1.1 I get an error:

       

      20:56:05,612 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-44) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! null

          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:376) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

      Caused by: java.lang.UnsupportedOperationException

          at javax.faces.application.Application.getResourceHandler(Application.java:287) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

          at javax.faces.application.ApplicationWrapper.getResourceHandler(ApplicationWrapper.java:506) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

          at com.sun.faces.config.processor.ApplicationConfigProcessor.setResourceHandler(ApplicationConfigProcessor.java:766) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:313) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222) [jsf-impl-2.1.7-jbossorg-2.jar:]

          at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361) [jsf-impl-2.1.7-jbossorg-2.jar:]

          ... 9 more

       

        The problem can be reproduced by building a web-application with these Maven dependencies:

       

             <dependency>

                  <groupId>org.jboss.seam</groupId>

                  <artifactId>jboss-seam</artifactId>

                  <version>2.3.0.Final</version>

              </dependency>

       

              <dependency>

                  <groupId>org.openfaces</groupId>

                  <artifactId>openfaces</artifactId>

                  <version>3.0</version>

              </dependency>

       

      I have tried to debug the problem a litle. It seems like the problem arises from the fact, that both frameworks specifies an application factory in their faces-config.xml:

       

           <application-factory>org.jboss.seam.jsf.SeamApplicationFactory</application-factory>

       

                 and

       

           <application-factory>org.openfaces.application.OpenFacesApplicationFactory</application-factory>

       

      I think the error has "something" to do with injection of a "defaultApplication" object into the customized application objects. See "com.sun.faces.application.InjectionApplicationFactory.injectDefaultApplication()". Only one customized application object gets the deafult application injected and in this case it is "OpenFacesApplication."

       

      I have made some small experiments with the code and if I put the code snippet below into the SeamApplication class then my application will deploy without error:

       

          @Override

          public ResourceHandler getResourceHandler() {

              return application.getResourceHandler();   

          }

       

          @Override

          public void setResourceHandler(ResourceHandler resourceHandler) {

              application.setResourceHandler(resourceHandler);   

          }

       

          @Override

          public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass, Class<?> sourceClass, SystemEventListener listener) {

              application.subscribeToEvent(systemEventClass, sourceClass, listener); 

          } 

       

      Can anybody tell me if I am doing something wrong here or if it is a bug in the Seam code?