[ 
https://issues.apache.org/jira/browse/MYFACES-4030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15134681#comment-15134681
 ] 

Hank Ibell edited comment on MYFACES-4030 at 2/5/16 6:49 PM:
-------------------------------------------------------------

The patch provided removes setting cdiAvailable based on if the application map 
has a CDI bean manager or not. It simply sets cdiAvailable if the CDI bean 
manager is found on the classpath or not. The result of isCDIAvailable is still 
based on both CDI availability on the classpath and whether the application 
uses CDI or not however.

I see a problem with the log message written when cdiAvailable is set initially 
however. It is a bit misleading. It says that MyFaces CDI support is either 
enabled or disabled but since it the cached value is a static variable, it is 
only set and logged once per server. Could we change the log message from 
enabled/disabled to available/unavailable instead? CDI support may be 
available, but might be enabled/disabled depending on the application's 
requirement.


was (Author: hwibell):
The patch provided removes setting cdiAvailable based on if the application map 
has a CDI bean manager or not. It simply sets cdiAvailable if the CDI bean 
manager is found on the classpath or not. The result of isCDIAvailable is still 
based on both CDI availability on the classpath and whether the application 
uses CDI or not however.

I see a problem with the log message written when cdiAvailable is set initially 
however. It is a bit misleading. It says that MyFaces CDI support is either 
enabled or disabled but since it the cached value is a static variable, it is 
only set and logged once per server. Could we change the log message to 
enabled/disabled to available/unavailable instead? CDI support may be 
available, but might be enabled/disabled depending on the application's 
requirement.

> MyFaces CDI support is disabled if non-CDI application is loaded first
> ----------------------------------------------------------------------
>
>                 Key: MYFACES-4030
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4030
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.10-SNAPSHOT
>         Environment: WebSphere Liberty 8.5.5.8, Weld 2.3, MyFaces 2.2.8
>            Reporter: Hank Ibell
>            Priority: Minor
>         Attachments: myfaces-4030.patch
>
>
> If MyFaces 2.2 is loaded at the server level, MyFaces CDI support is set once 
> per server. This causes CDI-enabled JSF applications to not work properly if 
> a non-CDI application is loaded first.
> {panel:title=Steps to reproduce the error on WebSphere 
> Liberty|bgColor=#e8e8e8}
> 1. Enable the jsf-2.2 and cdi-1.2 features on the WebSphere Liberty server.
> 2. Deploy two JSF applications: one that uses CDI (e.g. a flow built using 
> FlowBuilder) and one that does not use CDI.
> 3. Make a request to the non-CDI application first. The message 'MyFaces CDI 
> support disabled' should be written to the logs.
> 4. Make a request to the CDI-enabled application. If testing an application 
> with a flow built using FlowBuilder, the flow will not be discovered.
> {panel}
> I've investigated the issue and found that MyFaces has two conditions to 
> determine CDI availability:
> 1. CDI must be found on the classpath
> 2. The application map must have a bean manager instance
> (Found inside 
> org.apache.myfaces.util.ExternalSpecifications#isCDIAvailable()).
> When MyFaces is shared between different applications, basing CDI 
> availability on an application's configuration (condition two) is an issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to