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

Martin Kočí commented on OWB-894:
---------------------------------

@Mark, you can see this misleading INFO + reason: 
java.lang.reflect.UndeclaredThrowableException with deltaSpike 0.5 with 
JSF-modul:

INFO: skipped deployment of: 
org.apache.deltaspike.jsf.impl.component.window.WindowIdHolderComponent reason: 
java.lang.reflect.UndeclaredThrowableException

reason is (not in the log):

Caused by: org.apache.webbeans.exception.WebBeansConfigurationException: Bean 
implementation class : 
org.apache.deltaspike.jsf.impl.component.window.WindowIdHolderComponent can not 
implement JSF UIComponent
        at 
org.apache.webbeans.jsf.plugin.OpenWebBeansJsfPlugin.isManagedBean(OpenWebBeansJsfPlugin.java:34)
        ... 28 more

The check (IComponent.class.isAssignableFrom(clazz) = "not a CDI Bean" is 100% 
correct but the Implementation with a expcetion is not reasonable. Exceptions 
are really for exceptional states and this one is a simple validation. I would 
suggest something like:

public List<ConstraintVialotion> isManagedBean( Class<?> clazz ) throws 
WebBeansConfigurationException
    {
        if (UIComponent.class.isAssignableFrom(clazz))
        {
             return Lists.newArrayList(new ConstraintViolation("Bean 
implementation class : " + clazz.getName()   + " can not implement JSF 
UIComponent"));
        }
    }
or something like that. 

OWB produce similar INFO by myfaces 2.2 deployment:
INFO: skipped deployment of: org.apache.myfaces.flow.cdi.FlowScopeCDIExtension 
reason: Bean implementation class can not implement 
javax.enterprise.inject.spi.Extension.!
Reason (not in the log):
org.apache.webbeans.exception.WebBeansConfigurationException: Bean 
implementation class can not implement javax.enterprise.inject.spi.Extension.!
        at 
org.apache.webbeans.util.WebBeansUtil.checkManagedBean(WebBeansUtil.java:286)
        at 
org.apache.webbeans.config.BeansDeployer.isValidManagedBean(BeansDeployer.java:657)

Again, I think this is no exeptional state, the combination a CDI-Archive with 
a javax.enterprise.inject.spi.Extension-implementation is pretty normal

> OpenWebBeansJsfPlugin logs "skipped deployment" on all @FacesComponent 
> classes with an UndeclaredThrowableException
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-894
>                 URL: https://issues.apache.org/jira/browse/OWB-894
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Bauke Scholtz
>
> Deployment of a project with JSF utility library OmniFaces 
> (https://code.google.com/p/omnifaces/) on TomEE 1.6.0 SNAPSHOT results in the 
> following log, whereby all @FacesComponent annotated classes are been 
> validated as managed beans:
> INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
> aug 21, 2013 3:31:57 PM org.apache.webbeans.config.BeansDeployer 
> isValidManagedBean
> INFO: skipped deployment of: org.omnifaces.component.tree.TreeNodeItem 
> reason: java.lang.reflect.UndeclaredThrowableException
> aug 21, 2013 3:31:57 PM org.apache.webbeans.config.BeansDeployer 
> isValidManagedBean
> INFO: skipped deployment of: org.omnifaces.component.output.OutputFormat 
> reason: java.lang.reflect.UndeclaredThrowableException
> aug 21, 2013 3:31:57 PM org.apache.webbeans.config.BeansDeployer 
> isValidManagedBean
> INFO: skipped deployment of: org.omnifaces.component.tree.TreeNode reason: 
> java.lang.reflect.UndeclaredThrowableException
> aug 21, 2013 3:31:57 PM org.apache.webbeans.config.BeansDeployer 
> isValidManagedBean
> INFO: skipped deployment of: 
> org.omnifaces.component.validator.ValidateAllOrNone reason: 
> java.lang.reflect.UndeclaredThrowableException
> [etc...]
> This is wrong in 2 ways:
> 1. Why are @FacesComponent classes validated as managed beans in first place? 
> They are nowhere in OmniFaces registered as managed beans.
> 2. The UndeclaredThrowableException in reason is unhelpful. It is hiding the 
> real reason.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to