You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Leonardo Uribe (JIRA)" <ji...@apache.org> on 2016/08/24 22:22:20 UTC

[jira] [Comment Edited] (OWB-1123) NPE at NormalScopeProxyFactory.createNormalScopeProxy during deserialization

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

Leonardo Uribe edited comment on OWB-1123 at 8/24/16 10:21 PM:
---------------------------------------------------------------

I can see that org.apache.myfaces.cdi.view.ViewScopeBeanHolder is the session scope bean that has the reference. The problem is in OWB, the use of @ViewScoped trigger the use of this bean (because this bean is the one that holds the view scope bean info), but if the deserialization happens on the right place, ApplicationContextBean should be available. The problem I see is the deserialisation step could happen outside CDI control, and OWB must ensure that case to work (the bean in that case must be resolved in a lazy way). In previous OWB versions, there was a wrapper over the beans, and I guess that wrapper had a logic to avoid that case. 


was (Author: lu4242):
I can that org.apache.myfaces.cdi.view.ViewScopeBeanHolder is the session scope bean that has the reference. The problem is in OWB, the use of @ViewScoped trigger the use of this bean (because this bean is the one that holds the view scope bean info), but if the deserialization happens on the right place, ApplicationContextBean should be available. The problem I see is the deserialisation step could happen outside CDI control, and OWB must ensure that case to work (the bean in that case must be resolved in a lazy way). In previous OWB versions, there was a wrapper over the beans, and I guess that wrapper had a logic to avoid that case. 

> NPE at NormalScopeProxyFactory.createNormalScopeProxy during deserialization
> ----------------------------------------------------------------------------
>
>                 Key: OWB-1123
>                 URL: https://issues.apache.org/jira/browse/OWB-1123
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: 1.6.2
>         Environment: TomEE 7.0.0.M2
>            Reporter: Bauke Scholtz
>            Assignee: Mark Struberg
>
> Imagine a session scoped bean which has an application scoped bean injected as property and it's being referenced in {{readObject()}}.
> {code}
> @SessionScoped
> public class SessionScopedBean {
>     @Inject
>     private ApplicationScopedBean appBean;
>     private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException {
>         appBean.doSomething();
>     }
> }
> {code}
> OWB 1.6.2 as used in TomEE 7.0.0.M2 throws below exception when TomEE is restarted with session persistence (and above bean is created during that session):
> {code}
> java.lang.NullPointerException
>     at org.apache.webbeans.proxy.NormalScopeProxyFactory.createNormalScopeProxy(NormalScopeProxyFactory.java:121)
>     at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.readResolve(NormalScopedBeanInterceptorHandler.java:125)
> {code}
> It works fine in all Weld 2.x versions I tested so far (WF8/9/10, PY4 and "plain" Tomcat8+Weld 2.3.0).
> Work around would be to use a static method on application scoped bean, but this is not nice.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)