Bug 1096905 - InstantiationException on WeldApplicationFactory when switching to JSF 1.2 in EAP 6.2.
Summary: InstantiationException on WeldApplicationFactory when switching to JSF 1.2 in...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JSF
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: TBD EAP 7,TBD EAP 6
Assignee: Farah Juma
QA Contact: Marek Schmidt
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-12 16:05 UTC by ivassile
Modified: 2018-12-05 18:32 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
JBoss EAP 6 allows users to choose a JSF version for a deployment using descriptors bundled with the deployment. This, however, currently does not work correctly when the deployment also uses CDI. It is currently not possible to have two different deployments use different versions of JSF if both deployments also use CDI. When this is attempted, an exception is thrown and the deployment fails with the following error: ---- java.lang.InstantiationException: org.jboss.as.weld.webtier.jsf.WeldApplicationFactory ---- Though using JSF 1.2 with CDI is not officially supported, since JSF 1.2 is an EE5 technology and CDI is an EE6 technology, it is still possible to make JSF 1.2 work with CDI for all deployments using the following workaround: 1. Set 1.2 as the default JSF version in EAP by executing the following command in jboss-cli: `/subsystem=jsf/:write-attribute(name=default-jsf-impl-slot,value=1.2)` 2. Configure JSF 1.2 dependency for the Weld module in both `/modules/system/layers/base/org/jboss/weld/core/main/module.xml and `/modules/system/layers/base/org/jboss/as/weld/main/module.xml` by changing the line `<module name="javax.faces.api"/>` to `<module name="javax.faces.api" slot="1.2" />` 3. Restart the server.
Clone Of:
Environment:
Last Closed: 2015-06-23 12:54:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description ivassile 2014-05-12 16:05:45 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 ivassile 2014-05-12 16:10:42 UTC
Jozef Hartinger comment:

"...The problem is that JSF's FactoryFinder does not find org.jboss.as.weld.webtier.jsf.WeldApplicationFactory's constructor because the FactoryFinder uses the JSF 1.2 version of ApplicationFactory whereas WeldApplicationFactory is loaded with the 2.0 version."

Comment 2 ivassile 2014-05-12 16:12:09 UTC
Exception:

09:02:14,618 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cgiweb]] (ServerService Thread Pool -- 90) 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(Unknown Source) [jsf-impl-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at com.sun.faces.config.ConfigureListener.contextInitialized(Unknown Source) [jsf-impl-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
        at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
        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.newInstance0(Class.java:357) [rt.jar:1.7.0]
        at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0]
        at javax.faces.FactoryFinder.getImplGivenPreviousImpl(Unknown Source) [jsf-api-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at javax.faces.FactoryFinder.getImplementationInstance(Unknown Source) [jsf-api-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at javax.faces.FactoryFinder.access$400(Unknown Source) [jsf-api-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at javax.faces.FactoryFinder$FactoryManager.getFactory(Unknown Source) [jsf-api-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at javax.faces.FactoryFinder.getFactory(Unknown Source) [jsf-api-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(Unknown Source) [jsf-impl-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(Unknown Source) [jsf-impl-1.2_15-b01-redhat-8.jar:1.2_15-b01-redhat-8]

Comment 3 Farah Juma 2014-05-12 17:35:30 UTC
Ilia, do you have a reproducer app for this?

Comment 4 Farah Juma 2014-05-12 18:11:02 UTC
Clearing the needinfo request here since I was able to create a reproducer.

Comment 5 Farah Juma 2014-05-13 14:23:47 UTC
To deploy an application that requires JSF 1.2 + Weld, the workaround that modifies the JSF dependency in the Weld module files does work in EAP 6.2 as long as the default JSF implementation is changed to JSF 1.2 as follows:

1) In the CLI, execute this command:
/subsystem=jsf/:write-attribute(name=default-jsf-impl-slot,value=1.2)

2) Restart the server.

With multi-JSF support in EAP 6.2, Weld can only be used with one JSF implementation at a time though [1]. This means that it's not possible to have two applications deployed such that one application requires JSF 1.2 + Weld and the other one requires JSF 2 + Weld. Support for allowing multiple JSF implementations to work with Weld was added to WildFly but that aren't any plans to backport this behaviour to EAP 6.x [2]. However, note that Stuart Douglas recently pointed out that JSF 1.2 + Weld isn't actually a supported combination [3].



[1] https://issues.jboss.org/browse/EAP6-34?focusedCommentId=12937699&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12937699
[2] https://issues.jboss.org/browse/WFLY-682
[3] https://issues.jboss.org/browse/WFLY-3215?focusedCommentId=12959160&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12959160

Comment 6 ivassile 2014-05-15 19:16:27 UTC
Client accepted the workaround and closed the case.


Note You need to log in before you can comment on or make changes to this bug.