eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
160 stars 109 forks source link

Could not resolve injected property in custom @FacesComponent #4010

Closed ren-zhijun-oracle closed 9 years ago

ren-zhijun-oracle commented 9 years ago

This looks like Mojarra regression IMO. Having this @FacesComponent:

@FacesComponent("com.infina.ops.tags.TestTag")
public class TestTag extends UINamingContainer {

    public String getHello() {
        return this.getHs().getHello();
    }

    @Inject
    private EquityServiceBizImpl hs;

    public EquityServiceBizImpl getHs() {
        return this.hs;
    }
}

Evaluating TestTag property value results in:

Caused by: java.lang.NullPointerException
    at com.infina.ops.tags.TestTag.getHello(TestTag.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:204)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(ContextualCompositeValueExpression.java:158)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:174)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:114)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
    at com.sun.faces.renderkit.html_basic.CompositeRenderer.encodeChildren(CompositeRenderer.java:78)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:655)
    ... 27 more

I've experimented on WidlFly 8.2.0.Final vs WildFly 9.0.1.Final. When I used older Mojarra in WildFly 9.0.1 it started to work again.

Affected Versions

[2.2.12, 2.2.11]

ren-zhijun-oracle commented 6 years ago
ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented Reported by tremes

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented tremes said: Reproducer could be found at https://issues.jboss.org/browse/WFLY-5057

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: Please send reproducer (with sources) to issues@javaserverfaces.java.net

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: Attached reproducer

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: According to 5.4.1 JSF Managed Classes and Java EE Annotations in JSF 2.2 specification PDF UIComponent is NOT listed as an injection target so @Inject is NOT supported.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented File: InjectTest.war Attached By: @manfredriem

ren-zhijun-oracle commented 7 years ago

@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-4006

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented Marked as invalid on Thursday, August 6th 2015, 6:39:48 am