Volodymyr Siedlecki created MYFACES-4299:
--------------------------------------------

             Summary: ManagedProperty & Websocket: NullPointerException 
                 Key: MYFACES-4299
                 URL: https://issues.apache.org/jira/browse/MYFACES-4299
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-372
    Affects Versions: 2.3.4, 2.3.3, 2.3.2, 2.3.1, 2.3.0
         Environment: Tomcat 
            Reporter: Volodymyr Siedlecki


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. 

If you 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. 

 

I’ve provided a sample application which reproduces the error.  

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)

Reply via email to