[
https://issues.apache.org/jira/browse/MYFACES-4299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16896107#comment-16896107
]
Bill Lucy commented on MYFACES-4299:
------------------------------------
[~tandraschko] would you mind if I port your 3.x change to 2.3?
> ManagedProperty & Websocket: NullPointerException
> --------------------------------------------------
>
> Key: MYFACES-4299
> URL: https://issues.apache.org/jira/browse/MYFACES-4299
> Project: MyFaces Core
> Issue Type: Improvement
> Components: JSR-372
> Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4
> Environment: Tomcat
> Reporter: Volodymyr Siedlecki
> Assignee: Thomas Andraschko
> Priority: Minor
> Fix For: 3.0.0-SNAPSHOT
>
> Attachments: MYFACES-4299-app.zip
>
>
> Hello,
>
> I have a sample JSF 2.3.3 application that uses @ManagedProperty with a web
> socket observer class. This application throws a null pointer exception.
> In the createManagedProperty of the ManagedPropertyProducer class,
> FacesContext.getCurrentInstance() returns null.
> In the createManagedProperty method, if you catch the error and create a new
> facesContext via BeanProvider.getContextualReference, the example still won’t
> work. Is there any way around this error?
> Or can anyone confirm that this example is not a valid use of
> ManagedProperty? It doesn’t seem like it since the communication is going
> through web sockets and therefore isn’t hitting the Faces Servlet.
>
> Also, this application doesn't work with the mojarra 2.3 code either.
>
> I’ve provided the sample application.
> Here is the stack trace:
> java.lang.NullPointerException
> at
> org.apache.myfaces.cdi.managedproperty.ManagedPropertyProducer.createManagedProperty(ManagedPropertyProducer.java:83)
> at
> org.apache.myfaces.cdi.managedproperty.ManagedPropertyProducer.lambda$new$0(ManagedPropertyProducer.java:77)
> at
> org.apache.myfaces.cdi.util.AbstractDynamicProducer.create(AbstractDynamicProducer.java:97)
> at
> org.apache.webbeans.component.third.ThirdpartyBeanImpl.create(ThirdpartyBeanImpl.java:97)
> at
> org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
> at
> org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
> at
> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:813)
> at
> org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:673)
>
> Thank you
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)