Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 2.0.5
    • Fix Version/s: None
    • Component/s: Trinidad Support
    • Labels:
      None
    • Environment:
      Projecto using
       - JSF 2.0.3
       - Trinidad 2.0.0-beta-2

      or

       - JSF 2.1.7-SNAPSHOT
       - Trinidad 2.0.2-SNAPSHOT

      Both

      Weld 1.1.4-Final
      Weld 1.1.5-Final

      Description

      Error processing trinidad components.

      For testing, I override the encodeBegin method, and it worked without super.encodeBegin

      There is a solution for this error?

      Caused by: java.lang.IllegalStateException: No CreationalContext registered for EL evaluation, it is likely that the the expression factory has not been wrapped by the CDI BeanManager, which must be done to use the ELResolver from CDI
      at org.jboss.weld.el.AbstractWeldELResolver.getELCreationalContext(AbstractWeldELResolver.java:148)
      at org.jboss.weld.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:123)
      at org.jboss.weld.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:96)
      at org.jboss.weld.environment.servlet.util.ForwardingELResolver.getValue(ForwardingELResolver.java:49)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at org.apache.myfaces.extensions.validator.core.el.DefaultELHelper.getBean(DefaultELHelper.java:79)
      at org.apache.myfaces.extensions.validator.beanval.util.BeanValidationUtils.addMetaDataToContext(BeanValidationUtils.java:119)
      at org.apache.myfaces.extensions.validator.beanval.interceptor.ExtValBeanValidationMetaDataExtractionInterceptor.processExtValBeanValidationMetaData(ExtValBeanValidationMetaDataExtractionInterceptor.java:82)
      at org.apache.myfaces.extensions.validator.beanval.interceptor.ExtValBeanValidationMetaDataExtractionInterceptor.afterExtracting(ExtValBeanValidationMetaDataExtractionInterceptor.java:61)
      at org.apache.myfaces.extensions.validator.util.ExtValUtils.invokeMetaDataExtractionInterceptors(ExtValUtils.java:268)
      at org.apache.myfaces.extensions.validator.util.ExtValUtils.access$100(ExtValUtils.java:79)
      at org.apache.myfaces.extensions.validator.util.ExtValUtils$1.extract(ExtValUtils.java:236)
      at org.apache.myfaces.extensions.validator.beanval.BeanValidationModuleValidationInterceptorInternals.extractPropertyDetails(BeanValidationModuleValidationInterceptorInternals.java:64)
      at org.apache.myfaces.extensions.validator.beanval.BeanValidationModuleValidationInterceptor.initComponent(BeanValidationModuleValidationInterceptor.java:55)
      at org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor.beforeEncodeBegin(AbstractValidationInterceptor.java:112)
      at org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper.encodeBegin(ExtValRendererWrapper.java:162)
      at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:987)

      1. validation.zip
        94 kB
        Igor Guimaraes
      2. validation.zip
        94 kB
        Igor Guimaraes

        Activity

        Hide
        Gerald Turner added a comment -

        FYI, I opened a Weld bug on the JBoss JIRA, while I don't use Trinidad, I have come across this issue with CDI and ExtVal, work-around as Igor described - https://issues.jboss.org/browse/WELD-1280

        Show
        Gerald Turner added a comment - FYI, I opened a Weld bug on the JBoss JIRA, while I don't use Trinidad, I have come across this issue with CDI and ExtVal, work-around as Igor described - https://issues.jboss.org/browse/WELD-1280
        Hide
        Gerhard Petracek added a comment -

        hi igor,

        the sample app is already quite special. however, as mentioned by rudy the correct starting point for detecting the issue is to analyze why it doesn't work only for some special el-expressions (esp. the difference to the other expressions). -> it would be nice if you provide those details.

        regards,
        gerhard

        Show
        Gerhard Petracek added a comment - hi igor, the sample app is already quite special. however, as mentioned by rudy the correct starting point for detecting the issue is to analyze why it doesn't work only for some special el-expressions (esp. the difference to the other expressions). -> it would be nice if you provide those details. regards, gerhard
        Hide
        Gerhard Petracek added a comment -

        hi igor,

        extval should work fine with weld (at least we know users who are using it with glassfish3.x -> weld).
        but i haven't tried it with 1.1.4+ - maybe there is a new issue.
        i'll have a closer look at your sample app.

        @mailing lists - see:
        http://myfaces.apache.org/mail-lists.html

        regards,
        gerhard

        Show
        Gerhard Petracek added a comment - hi igor, extval should work fine with weld (at least we know users who are using it with glassfish3.x -> weld). but i haven't tried it with 1.1.4+ - maybe there is a new issue. i'll have a closer look at your sample app. @mailing lists - see: http://myfaces.apache.org/mail-lists.html regards, gerhard
        Hide
        Igor Guimaraes added a comment -

        Gerhard,

        The point is that I have to fix a bug for I can use the ExtVal, and I'm trying to help solve.

        If there were an extension point for that class, or a way to override the class DefaultELHelper, I would do it through here.

        Although not a bug of ExtVal, is preventing me to use you project of our framework.

        This bug has been open for over a year, for a person who works with me, Rogerio Baldini, who also was in the email copy sent to Rudy.

        We are currently using version 1.1.4-Final and 1.1.5-Final of Weld with this bug still happening, and we can not use of ExtVal because of it.

        We corrected the problem in our framework, rather than waiting staff Weld correct.

        I thought we could try something like that, but I see that this is not so.

        I tried the mailing list, but could not find it, and I am still searching for...
        As I will use the project for you here, I need to interact more with mailing list.

        Thanks.

        Show
        Igor Guimaraes added a comment - Gerhard, The point is that I have to fix a bug for I can use the ExtVal, and I'm trying to help solve. If there were an extension point for that class, or a way to override the class DefaultELHelper, I would do it through here. Although not a bug of ExtVal, is preventing me to use you project of our framework. This bug has been open for over a year, for a person who works with me, Rogerio Baldini, who also was in the email copy sent to Rudy. We are currently using version 1.1.4-Final and 1.1.5-Final of Weld with this bug still happening, and we can not use of ExtVal because of it. We corrected the problem in our framework, rather than waiting staff Weld correct. I thought we could try something like that, but I see that this is not so. I tried the mailing list, but could not find it, and I am still searching for... As I will use the project for you here, I need to interact more with mailing list. Thanks.
        Hide
        Gerhard Petracek added a comment -

        hi igor,

        basically thx for reporting issues.
        however, if you have any issue, please tell us the use-case which doesn't work for you instead of posting suggestions how to change/fix XYZ.

        please also consider to contact one of our mailing lists before filing a bug
        e.g. this issue looks like a weld issue (e.g. [1]). >if< that's the case, it isn't an extval issue

        regards,
        gerhard

        [1] https://issues.jboss.org/browse/WELD-810

        Show
        Gerhard Petracek added a comment - hi igor, basically thx for reporting issues. however, if you have any issue, please tell us the use-case which doesn't work for you instead of posting suggestions how to change/fix XYZ. please also consider to contact one of our mailing lists before filing a bug e.g. this issue looks like a weld issue (e.g. [1] ). >if< that's the case, it isn't an extval issue regards, gerhard [1] https://issues.jboss.org/browse/WELD-810
        Hide
        Igor Guimaraes added a comment -

        Happens a NullPointerException at class ExtValUtils, method getStorage.

        Modify for:

        public static <T> T getStorage(Class<T> storageType, String storageName)
        {
        T storage = getCachedStorage(storageType, storageName);

        if(storage != null)

        { return storage; }

        if(getStorageManagerFactory().create(storageType) != null)

        { storage = (T) getStorageManagerFactory().create(storageType).create(storageName); cacheStorageForRequest(storageType, storageName, storage); }

        return storage;
        }

        Thanks

        Igor Guimarães

        Show
        Igor Guimaraes added a comment - Happens a NullPointerException at class ExtValUtils, method getStorage. Modify for: public static <T> T getStorage(Class<T> storageType, String storageName) { T storage = getCachedStorage(storageType, storageName); if(storage != null) { return storage; } if(getStorageManagerFactory().create(storageType) != null) { storage = (T) getStorageManagerFactory().create(storageType).create(storageName); cacheStorageForRequest(storageType, storageName, storage); } return storage; } Thanks Igor Guimarães
        Hide
        Igor Guimaraes added a comment -

        Rudy,

        I understand that you said about validations performed, and I make the change:

        In class DefaultELHelper, change the method

        public Object getBean(String beanName)

        { FacesContext facesContext = FacesContext.getCurrentInstance(); return facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, beanName); }

        by method

        public Object getBean(String beanName)
        {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        ELContext elContext = FacesContext.getCurrentInstance().getELContext();
        ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();

        //ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, "#

        {employee}

        ", Object.class);
        // Change way to get a valueExpression
        ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, beanName, Object.class);

        return valueExpression.getValue(elContext);

        }

        it's correct?

        works for me...

        Thanks

        Show
        Igor Guimaraes added a comment - Rudy, I understand that you said about validations performed, and I make the change: In class DefaultELHelper, change the method public Object getBean(String beanName) { FacesContext facesContext = FacesContext.getCurrentInstance(); return facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, beanName); } by method public Object getBean(String beanName) { FacesContext facesContext = FacesContext.getCurrentInstance(); ELContext elContext = FacesContext.getCurrentInstance().getELContext(); ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory(); //ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, "# {employee} ", Object.class); // Change way to get a valueExpression ValueExpression valueExpression = expressionFactory.createValueExpression(elContext, beanName, Object.class); return valueExpression.getValue(elContext); } it's correct? works for me... Thanks
        Hide
        Igor Guimaraes added a comment -

        Rudy,

        Attached my project, and created two use case, using entities Company and Employee.

        Existist a BeanManager responsible for requests, CompanyMB and EmployeeMB, contends a producer of this entities.

        I try modify the scope for entities, but dosen't work.

        If you want run my application, unpack a validation.tomcat.zip on your webapp folder, and copy the validation.xml to

        {tomcat-home}

        /conf/Catalina/localhost/validation.xml

        Thanks

        Show
        Igor Guimaraes added a comment - Rudy, Attached my project, and created two use case, using entities Company and Employee. Existist a BeanManager responsible for requests, CompanyMB and EmployeeMB, contends a producer of this entities. I try modify the scope for entities, but dosen't work. If you want run my application, unpack a validation.tomcat.zip on your webapp folder, and copy the validation.xml to {tomcat-home} /conf/Catalina/localhost/validation.xml Thanks
        Hide
        Rudy De Busscher added a comment -

        Igor,

        Since you have the problem only with a certain set of beans, you have to identify why a certain bean has the problem and another one not. A possibility is the type or the scope.

        The solution you propose is wrong. Because it doesn't get the bean identified by the name stored in key[0] but the 'object' (A bean that describes the component, see org.apache.myfaces.trinidad.bean.FacesBean) attached to component itself. your getFacesBean() method doesn't know the bean name (you don't pass the key[0] value) You won't have any validations performed by ExtVal, only by Hibernate.

        Without an example it is difficult for me to figure out what exactly is wrong.

        Regards
        Rudy

        Show
        Rudy De Busscher added a comment - Igor, Since you have the problem only with a certain set of beans, you have to identify why a certain bean has the problem and another one not. A possibility is the type or the scope. The solution you propose is wrong. Because it doesn't get the bean identified by the name stored in key [0] but the 'object' (A bean that describes the component, see org.apache.myfaces.trinidad.bean.FacesBean) attached to component itself. your getFacesBean() method doesn't know the bean name (you don't pass the key [0] value) You won't have any validations performed by ExtVal, only by Hibernate. Without an example it is difficult for me to figure out what exactly is wrong. Regards Rudy
        Hide
        Igor Guimaraes added a comment -

        Rudy,

        I fixed the bug, changed the way of get the facesBean. I modified the method addMetaDataToContext of class DefaultELHelper, for get FacesBean Object using a method "getFacesBean" provided by Trinidad (using reflection), on class UIXComponentBase, ancestor of my JSF component .

        If you use a Trinidad in integrator ExtVal (myfaces-extval-trinidad-support), it would be interesting to use the API to retrieve this data.

        By now, i will use a modify version of 2.0.6-SNAPSHOT with my solution, and keep waiting a version with this issue fixed.

        Thank you.

        Igor Guimarães

        public static void addMetaDataToContext(
        UIComponent component, PropertyDetails propertyDetails, boolean processModelValidation)
        {
        String[] key = propertyDetails.getKey().split("
        .");

        Object firstBean = null;
        try

        { //elHelper.getBean(key[0]); firstBean = getFacesBean(component.getClass(), component); }

        catch (Exception e)

        { e.printStackTrace(); }

        if(firstBean == null)

        { firstBean = new Object(); }

        List<Class> foundGroupsForPropertyValidation = new ArrayList<Class>();
        List<Class> restrictedGroupsForPropertyValidation = new ArrayList<Class>();
        List<ModelValidationEntry> modelValidationEntryList = new ArrayList<ModelValidationEntry>();
        List<Class> restrictedGroupsForModelValidation = new ArrayList<Class>();

        String activeViewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();

        bvmi.extractExtValBeanValidationMetaData(propertyDetails,
        processModelValidation,
        key,
        firstBean,
        foundGroupsForPropertyValidation,
        restrictedGroupsForPropertyValidation,
        modelValidationEntryList,
        restrictedGroupsForModelValidation,
        activeViewId);

        bvmi.processExtValBeanValidationMetaData(component,
        propertyDetails,
        foundGroupsForPropertyValidation,
        restrictedGroupsForPropertyValidation,
        modelValidationEntryList,
        restrictedGroupsForModelValidation,
        activeViewId);
        }

        public static Object getFacesBean(Class clazz, UIComponent component) throws Exception
        {
        if(clazz.getMethod("getFacesBean") != null)

        { return clazz.getMethod("getFacesBean").invoke(component); }

        else

        { return getFacesBean(clazz.getSuperclass(), component); }

        }

        Show
        Igor Guimaraes added a comment - Rudy, I fixed the bug, changed the way of get the facesBean. I modified the method addMetaDataToContext of class DefaultELHelper, for get FacesBean Object using a method "getFacesBean" provided by Trinidad (using reflection), on class UIXComponentBase, ancestor of my JSF component . If you use a Trinidad in integrator ExtVal (myfaces-extval-trinidad-support), it would be interesting to use the API to retrieve this data. By now, i will use a modify version of 2.0.6-SNAPSHOT with my solution, and keep waiting a version with this issue fixed. Thank you. Igor Guimarães public static void addMetaDataToContext( UIComponent component, PropertyDetails propertyDetails, boolean processModelValidation) { String[] key = propertyDetails.getKey().split(" ."); Object firstBean = null; try { //elHelper.getBean(key[0]); firstBean = getFacesBean(component.getClass(), component); } catch (Exception e) { e.printStackTrace(); } if(firstBean == null) { firstBean = new Object(); } List<Class> foundGroupsForPropertyValidation = new ArrayList<Class>(); List<Class> restrictedGroupsForPropertyValidation = new ArrayList<Class>(); List<ModelValidationEntry> modelValidationEntryList = new ArrayList<ModelValidationEntry>(); List<Class> restrictedGroupsForModelValidation = new ArrayList<Class>(); String activeViewId = FacesContext.getCurrentInstance().getViewRoot().getViewId(); bvmi.extractExtValBeanValidationMetaData(propertyDetails, processModelValidation, key, firstBean, foundGroupsForPropertyValidation, restrictedGroupsForPropertyValidation, modelValidationEntryList, restrictedGroupsForModelValidation, activeViewId); bvmi.processExtValBeanValidationMetaData(component, propertyDetails, foundGroupsForPropertyValidation, restrictedGroupsForPropertyValidation, modelValidationEntryList, restrictedGroupsForModelValidation, activeViewId); } public static Object getFacesBean(Class clazz, UIComponent component) throws Exception { if(clazz.getMethod("getFacesBean") != null) { return clazz.getMethod("getFacesBean").invoke(component); } else { return getFacesBean(clazz.getSuperclass(), component); } }

          People

          • Assignee:
            Gerhard Petracek
            Reporter:
            Igor Guimaraes
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development