You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Jarek Gawor (JIRA)" <ji...@apache.org> on 2010/08/31 22:38:53 UTC

[jira] Created: (OPENEJB-1348) Circular @Startup singleton dependencies

Circular @Startup singleton dependencies
----------------------------------------

                 Key: OPENEJB-1348
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1348
             Project: OpenEJB
          Issue Type: Bug
          Components: deployment
    Affects Versions: (trunk/openejb3)
            Reporter: Jarek Gawor


Singleton ejbs with @Startup that have circular dependencies on each other (e.g. via @EJB injection) will fail to deploy. For example:

@Singleton @Startup
class Foo {
  @EJB Bar bar;
}

@Singleton @Startup
class Bar {
 @EJB Foo foo;
}

The Assembler.java tries to deploy the ejbs in the right order and it calls Container.deploy(). The SingletonContainer.deploy() does two things: 1) it registers the ejb in its registry and 2) instantiates the bean if the bean has @Startup. If the @Startup bean has circular dependencies on some other bean (e.g. via @EJB injection) the deployment will fail since the dependent bean has not been deployed yet. The solution to this problem is to split the ejb registration and instantiation into two separate methods. 


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


[jira] Updated: (OPENEJB-1348) Circular @Startup singleton dependencies

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

Jarek Gawor updated OPENEJB-1348:
---------------------------------

    Attachment: OPENEJB-1348.patch

A patch for this issue that add start() and stop() methods to the Container interface. This way, the Containder.deploy() will be used to register the bean and Container.start() will be used to actually instantiate the bean.
The patch also contain some updates to the singleton container that ensures the @DependsOn dependencies of a bean are instantiated before the bean is actually instantiated (in the the bean was lazy instantiated).



> Circular @Startup singleton dependencies
> ----------------------------------------
>
>                 Key: OPENEJB-1348
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1348
>             Project: OpenEJB
>          Issue Type: Bug
>          Components: deployment
>    Affects Versions: (trunk/openejb3)
>            Reporter: Jarek Gawor
>         Attachments: OPENEJB-1348.patch
>
>
> Singleton ejbs with @Startup that have circular dependencies on each other (e.g. via @EJB injection) will fail to deploy. For example:
> @Singleton @Startup
> class Foo {
>   @EJB Bar bar;
> }
> @Singleton @Startup
> class Bar {
>  @EJB Foo foo;
> }
> The Assembler.java tries to deploy the ejbs in the right order and it calls Container.deploy(). The SingletonContainer.deploy() does two things: 1) it registers the ejb in its registry and 2) instantiates the bean if the bean has @Startup. If the @Startup bean has circular dependencies on some other bean (e.g. via @EJB injection) the deployment will fail since the dependent bean has not been deployed yet. The solution to this problem is to split the ejb registration and instantiation into two separate methods. 

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


[jira] Resolved: (OPENEJB-1348) Circular @Startup singleton dependencies

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

Jarek Gawor resolved OPENEJB-1348.
----------------------------------

         Assignee: Jarek Gawor
    Fix Version/s: 3.2
       Resolution: Fixed

Committed the patch with some minor changes to trunk (revision 992094). 


> Circular @Startup singleton dependencies
> ----------------------------------------
>
>                 Key: OPENEJB-1348
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1348
>             Project: OpenEJB
>          Issue Type: Bug
>          Components: deployment
>    Affects Versions: (trunk/openejb3)
>            Reporter: Jarek Gawor
>            Assignee: Jarek Gawor
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1348.patch
>
>
> Singleton ejbs with @Startup that have circular dependencies on each other (e.g. via @EJB injection) will fail to deploy. For example:
> @Singleton @Startup
> class Foo {
>   @EJB Bar bar;
> }
> @Singleton @Startup
> class Bar {
>  @EJB Foo foo;
> }
> The Assembler.java tries to deploy the ejbs in the right order and it calls Container.deploy(). The SingletonContainer.deploy() does two things: 1) it registers the ejb in its registry and 2) instantiates the bean if the bean has @Startup. If the @Startup bean has circular dependencies on some other bean (e.g. via @EJB injection) the deployment will fail since the dependent bean has not been deployed yet. The solution to this problem is to split the ejb registration and instantiation into two separate methods. 

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