You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Bauke Scholtz (JIRA)" <ji...@apache.org> on 2016/07/04 07:50:11 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=15360972#comment-15360972 ] 

Bauke Scholtz edited comment on OWB-1123 at 7/4/16 7:49 AM:
------------------------------------------------------------

I've finally nailed it. It's not caused by OWB, but by MyFaces. Its [ViewScopeContextualStorage|http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.myfaces.core/myfaces-impl/2.2.8/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java/?v=source] is stored in session, but it has a non-transient BeanManager property. The BeanManager interface is not declared to be Serializable. In Weld, the BeanManagerImpl is Serializable, but not in OWB. So I gather this is a bug in MyFaces. If you agree this is a bug in MyFaces, I will report over there.

I've boiled down the smallest possible reproducer: just have a {{@Named @javax.faces.view.ViewScoped}} bean and reference it in a JSF page.

{code}
@Named
@ViewScoped
public class Bean implements Serializable {}
{code}

{code}
<!DOCTYPE html>
#{bean}
{code}


was (Author: balusc):
I've finally nailed it. It's not caused by OWB, but by MyFaces. Its [ViewScopeContextualStorage|http://grepcode.com/file_/repo1.maven.org/maven2/org.apache.myfaces.core/myfaces-impl/2.2.8/org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java/?v=source is stored in session, but it has a non-transient BeanManager property. The BeanManager interface is not declared to be Serializable. In Weld, the BeanManagerImpl is Serializable, but not in OWB. So I gather this is a bug in MyFaces. If you agree this is a bug in MyFaces, I will report over there.

I've boiled down the smallest possible reproducer: just have a {{@Named @javax.faces.view.ViewScoped}} bean and reference it in a JSF page.

{code}
@Named
@ViewScoped
public class Bean implements Serializable {}
{code}

{code}
<!DOCTYPE html>
#{bean}
{code}

> 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)