You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2010/01/22 15:39:21 UTC

[jira] Created: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

BeanManager#getReference must create a bean with resolved dependencies
----------------------------------------------------------------------

                 Key: OWB-246
                 URL: https://issues.apache.org/jira/browse/OWB-246
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Context and Scopes
    Affects Versions: M3
            Reporter: Mark Struberg
            Assignee: Gurkan Erdogdu


currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804113#action_12804113 ] 

Mark Struberg commented on OWB-246:
-----------------------------------

I'm still trying to write a test case for it, but that's harder than I thought.

I have this problem in a real application and if looks as if in ObserverMethodImpl # 204 this.observerMethod.invoke(object, args); the invoked method doesn't use the proxy. Not sure why, still elaborating.

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Gurkan Erdogdu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gurkan Erdogdu updated OWB-246:
-------------------------------

    Fix Version/s: 1.0.0

Could you attach a test case?

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804147#action_12804147 ] 

Mark Struberg commented on OWB-246:
-----------------------------------

somehow the NormalScopedBeanInterceptorHandler does not get called as we can see from this stack trace:

	  at at.ac.tuwien.tiss.core.fe.menu.MenuBean.changeMenuLanguage(MenuBean.java:60)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	  at java.lang.reflect.Method.invoke(Method.java:597)
	  at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:204)
	  at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:310)
	  at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:315)
	  at org.apache.webbeans.event.EventImpl.fire(EventImpl.java:67)
	  at at.ac.tuwien.tiss.core.fe.LanguageSettingRequestModel.english(LanguageSettingRequestModel.java:38)

still digging deeper ...

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>             Fix For: 1.0.0
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg updated OWB-246:
------------------------------

    Priority: Blocker  (was: Major)

rated up to be a blocker because proxy handlers don't get called in events which will almost ever lead to NullPointerExceptions.

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>            Priority: Blocker
>             Fix For: 1.0.0
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12803741#action_12803741 ] 

Mark Struberg commented on OWB-246:
-----------------------------------

please note that this e.g. hits you if you implement a @Observes method with Reception.ALWAYS and the contextual instance doesn't yet exist.

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-246.
-------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.0.0)
                   M4
         Assignee: Mark Struberg  (was: Gurkan Erdogdu)

fixed as far as the references. Please note that the problem with my private observer methods is caused by a different bug. See OWB-251 for more details.

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>            Priority: Blocker
>             Fix For: M4
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804173#action_12804173 ] 

Mark Struberg commented on OWB-246:
-----------------------------------

ok, found the problem: we cannot proxy private functions. The method handler is simply not called for private functions
I'm not sure why the observerMethod.invoke() calls the internal private function in this situation but this shall not be allowed.
Need to clarify if this is allowed in the spec

> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>            Priority: Blocker
>             Fix For: 1.0.0
>
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OWB-246) BeanManager#getReference must create a bean with resolved dependencies

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12803722#action_12803722 ] 

Mark Struberg commented on OWB-246:
-----------------------------------

Oki, got a bit confused and found the real source of the problem.

Since a contextual reference is obviously a proxy all those fields are initially null.
The problem is that we do _not_ proxy field access but only method access.

Assuming we have a Bean
{noformat}
public class MyBean {
  private @Inject MyService svc;

  public int getValueFromService() {
    svc.getValue();
  }
}
{noformat}
currently fails with a NullPointerException

All works well if I use a getter for accessing svc via getMyService() in #getValueFromService();



> BeanManager#getReference must create a bean with resolved dependencies
> ----------------------------------------------------------------------
>
>                 Key: OWB-246
>                 URL: https://issues.apache.org/jira/browse/OWB-246
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Context and Scopes
>    Affects Versions: M3
>            Reporter: Mark Struberg
>            Assignee: Gurkan Erdogdu
>
> currently a bean reference will get returned but it all @Inject fields are null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.