How to configure jboss-deployment-structure.xml in EAR files to force Weld to use JSF Version 1.2?
Issue
- If Weld is not forced to use JSF Version 1.2, it picks the 2.1 Version (despite the declaration of Mojarra-1.2 in web.xml) and the following error occurs:
14:30:27,385 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/CDI_JSF_WebDemo]] (ServerService Thread Pool -- 63) JBWEB000287: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:215) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:200) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory
at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_65]
at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:537) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:187) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:132) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:205) [jsf-impl-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3]
... 12 more
14:30:27,388 ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 63) JBWEB001103: Error detected during context /CDI_JSF_WebDemo start, will stop it
14:30:27,395 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 63) MSC000001: Failed to start service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_65]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:161)
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60)
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93)
... 6 more
14:30:27,604 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "CDI_JSF_WebDemo.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./CDI_JSF_WebDemo" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./CDI_JSF_WebDemo: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context
Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS018040: Failed to start context"}}
- If the following Weld modules in JBoss are modified to use JSF Version 1.2, the error does not appear and everything works fine:
"jboss-eap-6.1.0/modules/system/layers/base/org/jboss/as/weld/main/module.xml"
"jboss-eap-6.1.0/modules/system/layers/base/org/jboss/weld/core/main/module.xml"
<dependencies>
...
<module name="javax.faces.api" slot="1.2"/>
...
</dependencies>
- But we get stuck if we try to achieve the same with
"META-INF/jboss-deployment-structure.xml"
. The error appears again:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="javax.faces.api"/>
<module name="com.sun.jsf-impl"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
- How to use the
"jboss-deployment-structure.xml"
to achieve the same effect as modifying the module dependency definitions? - Is there a "Per Application" solution available, because changing the whole JBoss instance to use JSF 1.2 will cause problems with our JSF 2.0 Applications.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.