patch for review

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

patch for review

Thiago Veronezi-2
Hi, devs!
Im still alive... Im just having a good rush at work these days. Anyways, I
just found an opportunity to contribute for both projects. :O)

I've opened and fixed the following issue:
https://issues.apache.org/jira/browse/OPENEJB-1304
When you have time, please review this guy for me.

tkx,
Thiago.

---------- Forwarded message ----------
From: David Blevins <[hidden email]>
Date: Thu, Jun 24, 2010 at 6:15 AM
Subject: Callback Overrides
To: [hidden email]


Hi Shawn!

Missed this patch in JIRA.  Feel free to post anytime you have a patch for
review.

On Jun 13, 2010, at 12:22 AM, Shawn Jiang (JIRA) wrote:
.
.
.
Reply | Threaded
Open this post in threaded view
|

Startup order (Re: patch for review

dblevins
Administrator

On Jun 24, 2010, at 12:48 PM, Thiago Veronezi wrote:

> Hi, devs!
> Im still alive... Im just having a good rush at work these days. Anyways, I
> just found an opportunity to contribute for both projects. :O)

:)

> I've opened and fixed the following issue:
> https://issues.apache.org/jira/browse/OPENEJB-1304
> When you have time, please review this guy for me.

Looks like there may be a startup ordering issue related to this added feature:

  https://issues.apache.org/jira/browse/OPENEJB-1296

I committed the part of the patch that deals with avoiding calling PreDestroy on instances that where never created -- good catch!  The assembler fix that changes the sort order isn't quite right as it is essentially what we had before OPENEJB-1296, but clearly something along that lines will be needed.  I'm not sure if this will work, but I tried adding back in the "sort singletons to the back" sort but this time before the @DependsOn sort so the @DependsOn will still take precedence.  That's the theory anyway, not sure if the @DependsOn is a stable sort -- seem to recall it was slightly unstable -- and it may not do the trick.

Any chance you can give it a whirl and let us know if it does the trick?

Thanks for reporting this, Thiago!


-David

Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

Thiago Veronezi
Hi, David!
Thanks for the commit.
I tried to run my application again. This time with the latest commit,
but unfortunately it is not working yet. I'm facing the same exception.
Ill try to find another way to fix it.
tkx,
Thiago.

The stacktrace...
.
.
.
  [exec] The bean instance threw a system exception:javax.ejb.EJBException:
Unknown Container Exception
     [exec] javax.ejb.EJBException: Unknown Container Exception
     [exec] at
org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
     [exec] at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
     [exec] at $Proxy48.create(Unknown Source)
     [exec] at
org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
     [exec] at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
     [exec] at
org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
     [exec] at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
     [exec] at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
     [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
     [exec] at
org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
     [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [exec] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [exec] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [exec] at java.lang.reflect.Method.invoke(Method.java:597)
     [exec] at
org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
     [exec] at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
     [exec] at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
     [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
     [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
     [exec] at iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
     [exec] at
iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
     [exec] at java.lang.Thread.run(Thread.java:619)
     [exec] Application could not be deployed:
 /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar
     [exec] org.apache.openejb.OpenEJBException: Creating application
failed: /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar:
Error deploying 'ApplicationImpl'.  Exception: class
org.apache.openejb.OpenEJBException: Singleton startup failed:
ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
initialize: Singleton failed to initialize: Singleton startup failed:
ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
initialize: Singleton failed to initialize
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:673)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
     [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [exec] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [exec] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [exec] at java.lang.reflect.Method.invoke(Method.java:597)
     [exec] at
org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
     [exec] at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
     [exec] at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
     [exec] at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
     [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
     [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
     [exec] at iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
     [exec] at
iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
     [exec] at java.lang.Thread.run(Thread.java:619)
     [exec] Caused by: org.apache.openejb.OpenEJBException: Error deploying
'ApplicationImpl'.  Exception: class org.apache.openejb.OpenEJBException:
Singleton startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException:
Singleton failed to initialize: Singleton failed to initialize: Singleton
startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
failed to initialize: Singleton failed to initialize
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:601)
     [exec] ... 22 more
     [exec] Caused by: org.apache.openejb.OpenEJBException: Singleton
startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
failed to initialize: Singleton failed to initialize
     [exec] at
org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:146)
     [exec] at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
     [exec] ... 22 more
     [exec] Caused by: org.apache.openejb.ApplicationException:
javax.ejb.NoSuchEJBException: Singleton failed to initialize: Singleton
failed to initialize
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:243)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
     [exec] at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
     [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
     [exec] at
org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
     [exec] ... 23 more
     [exec] Caused by: javax.ejb.NoSuchEJBException: Singleton failed to
initialize
     [exec] ... 31 more
     [exec] Caused by: javax.ejb.EJBException: Unknown Container Exception
     [exec] at
org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
     [exec] at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
     [exec] at $Proxy48.create(Unknown Source)
     [exec] at
org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
     [exec] at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
     [exec] at
org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
     [exec] at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
     [exec] at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
     [exec] ... 30 more
.
.
.



On Wed, Jul 7, 2010 at 3:34 AM, David Blevins <[hidden email]>wrote:

>
> On Jun 24, 2010, at 12:48 PM, Thiago Veronezi wrote:
>
> > Hi, devs!
> > Im still alive... Im just having a good rush at work these days. Anyways,
> I
> > just found an opportunity to contribute for both projects. :O)
>
> :)
>
> > I've opened and fixed the following issue:
> > https://issues.apache.org/jira/browse/OPENEJB-1304
> > When you have time, please review this guy for me.
>
> Looks like there may be a startup ordering issue related to this added
> feature:
>
>  https://issues.apache.org/jira/browse/OPENEJB-1296
>
> I committed the part of the patch that deals with avoiding calling
> PreDestroy on instances that where never created -- good catch!  The
> assembler fix that changes the sort order isn't quite right as it is
> essentially what we had before OPENEJB-1296, but clearly something along
> that lines will be needed.  I'm not sure if this will work, but I tried
> adding back in the "sort singletons to the back" sort but this time before
> the @DependsOn sort so the @DependsOn will still take precedence.  That's
> the theory anyway, not sure if the @DependsOn is a stable sort -- seem to
> recall it was slightly unstable -- and it may not do the trick.
>
> Any chance you can give it a whirl and let us know if it does the trick?
>
> Thanks for reporting this, Thiago!
>
>
> -David
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

Thiago Veronezi
David,
I've tried the dependsOn annotation too, and the singleton bean is executed
before the stateless beans initialization.
[]s,
Thiago.

On Wed, Jul 7, 2010 at 8:21 PM, Thiago Veronezi <[hidden email]> wrote:

> Hi, David!
> Thanks for the commit.
> I tried to run my application again. This time with the latest commit,
> but unfortunately it is not working yet. I'm facing the same exception.
> Ill try to find another way to fix it.
> tkx,
> Thiago.
>
> The stacktrace...
> .
> .
> .
>   [exec] The bean instance threw a system exception:javax.ejb.EJBException:
> Unknown Container Exception
>      [exec] javax.ejb.EJBException: Unknown Container Exception
>      [exec] at
> org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
>      [exec] at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
>      [exec] at $Proxy48.create(Unknown Source)
>      [exec] at
> org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
>      [exec] at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>      [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
>      [exec] at
> org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>      [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>      [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>      [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>      [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [exec] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [exec] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [exec] at java.lang.reflect.Method.invoke(Method.java:597)
>      [exec] at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>      [exec] at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>      [exec] at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>      [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
>      [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
>      [exec] at
> iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
>      [exec] at
> iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
>      [exec] at java.lang.Thread.run(Thread.java:619)
>      [exec] Application could not be deployed:
>  /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar
>      [exec] org.apache.openejb.OpenEJBException: Creating application
> failed: /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar:
> Error deploying 'ApplicationImpl'.  Exception: class
> org.apache.openejb.OpenEJBException: Singleton startup failed:
> ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
> initialize: Singleton failed to initialize: Singleton startup failed:
> ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
> initialize: Singleton failed to initialize
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:673)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
>      [exec] at
> org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>      [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>      [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>      [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>      [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [exec] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [exec] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [exec] at java.lang.reflect.Method.invoke(Method.java:597)
>      [exec] at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>      [exec] at
> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>      [exec] at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>      [exec] at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>      [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
>      [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
>      [exec] at
> iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
>      [exec] at
> iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
>      [exec] at java.lang.Thread.run(Thread.java:619)
>      [exec] Caused by: org.apache.openejb.OpenEJBException: Error deploying
> 'ApplicationImpl'.  Exception: class org.apache.openejb.OpenEJBException:
> Singleton startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException:
> Singleton failed to initialize: Singleton failed to initialize: Singleton
> startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
> failed to initialize: Singleton failed to initialize
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:601)
>      [exec] ... 22 more
>      [exec] Caused by: org.apache.openejb.OpenEJBException: Singleton
> startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
> failed to initialize: Singleton failed to initialize
>      [exec] at
> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:146)
>      [exec] at
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
>      [exec] ... 22 more
>      [exec] Caused by: org.apache.openejb.ApplicationException:
> javax.ejb.NoSuchEJBException: Singleton failed to initialize: Singleton
> failed to initialize
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:243)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
>      [exec] at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>      [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
>      [exec] ... 23 more
>      [exec] Caused by: javax.ejb.NoSuchEJBException: Singleton failed to
> initialize
>      [exec] ... 31 more
>      [exec] Caused by: javax.ejb.EJBException: Unknown Container Exception
>      [exec] at
> org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
>      [exec] at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
>      [exec] at $Proxy48.create(Unknown Source)
>      [exec] at
> org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
>      [exec] at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
>      [exec] at
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
>      [exec] ... 30 more
> .
> .
> .
>
>
>
> On Wed, Jul 7, 2010 at 3:34 AM, David Blevins <[hidden email]>wrote:
>
>>
>> On Jun 24, 2010, at 12:48 PM, Thiago Veronezi wrote:
>>
>> > Hi, devs!
>> > Im still alive... Im just having a good rush at work these days.
>> Anyways, I
>> > just found an opportunity to contribute for both projects. :O)
>>
>> :)
>>
>> > I've opened and fixed the following issue:
>> > https://issues.apache.org/jira/browse/OPENEJB-1304
>> > When you have time, please review this guy for me.
>>
>> Looks like there may be a startup ordering issue related to this added
>> feature:
>>
>>  https://issues.apache.org/jira/browse/OPENEJB-1296
>>
>> I committed the part of the patch that deals with avoiding calling
>> PreDestroy on instances that where never created -- good catch!  The
>> assembler fix that changes the sort order isn't quite right as it is
>> essentially what we had before OPENEJB-1296, but clearly something along
>> that lines will be needed.  I'm not sure if this will work, but I tried
>> adding back in the "sort singletons to the back" sort but this time before
>> the @DependsOn sort so the @DependsOn will still take precedence.  That's
>> the theory anyway, not sure if the @DependsOn is a stable sort -- seem to
>> recall it was slightly unstable -- and it may not do the trick.
>>
>> Any chance you can give it a whirl and let us know if it does the trick?
>>
>> Thanks for reporting this, Thiago!
>>
>>
>> -David
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

dblevins
Administrator

On Jul 7, 2010, at 5:55 PM, Thiago Veronezi wrote:

> David,
> I've tried the dependsOn annotation too, and the singleton bean is executed
> before the stateless beans initialization.

Hmm.  The dependsOn sorting is reliable so if it doesn't work, it seems there might be a meta-data issue, maybe something preventing the dependsOn information from reaching the Assembler code reliably.  The tests we have use the JAXB tree and add the dependsOn information directly to it, so we know that works.  Could be there is an issue with the annotation->jaxb processing we do in the AnnotationDeployer.  We should probably add an DependsOn test that uses the annotation only.


On the overall issue of the Singleton starting before the Stateless when no @DependsOn is used anywhere, this is definitely wrong.  That should work by default.  There are plenty of people with singletons in their apps and they could all easily break now.  So we definitely can't release like that. :)  The fact that pre-sorting singletons to the back of the list before doing the dependsOn sorting doesn't work strongly indicates that the dependsOn sorting (see References and ReferencesTest) is not a stable sort (i.e. it changes the order even when there are no references).  The only way to fix that issue is to make the sorting done in References stable, so it only makes changes in order necessary to enforce the references.

Tricky bit of work indeed.  I added a couple test cases to ReferencesTest (_testNoReferences() and _testOrderedReferences()).  If we can get those to pass, we'll be in good shape.


-David


>
> On Wed, Jul 7, 2010 at 8:21 PM, Thiago Veronezi <[hidden email]> wrote:
>
>> Hi, David!
>> Thanks for the commit.
>> I tried to run my application again. This time with the latest commit,
>> but unfortunately it is not working yet. I'm facing the same exception.
>> Ill try to find another way to fix it.
>> tkx,
>> Thiago.
>>
>> The stacktrace...
>> .
>> .
>> .
>>  [exec] The bean instance threw a system exception:javax.ejb.EJBException:
>> Unknown Container Exception
>>     [exec] javax.ejb.EJBException: Unknown Container Exception
>>     [exec] at
>> org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
>>     [exec] at
>> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
>>     [exec] at $Proxy48.create(Unknown Source)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
>>     [exec] at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>     [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
>>     [exec] at
>> org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>>     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>>     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>>     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>>     [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     [exec] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     [exec] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     [exec] at java.lang.reflect.Method.invoke(Method.java:597)
>>     [exec] at
>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>>     [exec] at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>>     [exec] at
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>>     [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
>>     [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
>>     [exec] at
>> iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
>>     [exec] at
>> iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
>>     [exec] at java.lang.Thread.run(Thread.java:619)
>>     [exec] Application could not be deployed:
>> /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar
>>     [exec] org.apache.openejb.OpenEJBException: Creating application
>> failed: /home/boto/Desktop/ws_iserver/iroot/target/system/ejbs/iservice.jar:
>> Error deploying 'ApplicationImpl'.  Exception: class
>> org.apache.openejb.OpenEJBException: Singleton startup failed:
>> ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
>> initialize: Singleton failed to initialize: Singleton startup failed:
>> ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton failed to
>> initialize: Singleton failed to initialize
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:673)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
>>     [exec] at
>> org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>>     [exec] at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>>     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>>     [exec] at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>>     [exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     [exec] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     [exec] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     [exec] at java.lang.reflect.Method.invoke(Method.java:597)
>>     [exec] at
>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>>     [exec] at
>> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>>     [exec] at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>>     [exec] at
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>>     [exec] at javax.naming.InitialContext.init(InitialContext.java:223)
>>     [exec] at javax.naming.InitialContext.<init>(InitialContext.java:197)
>>     [exec] at
>> iserver.iserver.server.ejb.EjbServer.start(EjbServer.java:68)
>>     [exec] at
>> iserver.iserver.server.ejb.EjbServerThread.run(EjbServerThread.java:45)
>>     [exec] at java.lang.Thread.run(Thread.java:619)
>>     [exec] Caused by: org.apache.openejb.OpenEJBException: Error deploying
>> 'ApplicationImpl'.  Exception: class org.apache.openejb.OpenEJBException:
>> Singleton startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException:
>> Singleton failed to initialize: Singleton failed to initialize: Singleton
>> startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
>> failed to initialize: Singleton failed to initialize
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:601)
>>     [exec] ... 22 more
>>     [exec] Caused by: org.apache.openejb.OpenEJBException: Singleton
>> startup failed: ApplicationImpl: javax.ejb.NoSuchEJBException: Singleton
>> failed to initialize: Singleton failed to initialize
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:146)
>>     [exec] at
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:598)
>>     [exec] ... 22 more
>>     [exec] Caused by: org.apache.openejb.ApplicationException:
>> javax.ejb.NoSuchEJBException: Singleton failed to initialize: Singleton
>> failed to initialize
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:243)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:66)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:92)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:90)
>>     [exec] at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>     [exec] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:102)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonContainer.deploy(SingletonContainer.java:141)
>>     [exec] ... 23 more
>>     [exec] Caused by: javax.ejb.NoSuchEJBException: Singleton failed to
>> initialize
>>     [exec] ... 31 more
>>     [exec] Caused by: javax.ejb.EJBException: Unknown Container Exception
>>     [exec] at
>> org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(EjbHomeProxyHandler.java:264)
>>     [exec] at
>> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:282)
>>     [exec] at $Proxy48.create(Unknown Source)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.BusinessLocalReference.getObject(BusinessLocalReference.java:33)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IntraVmJndiReference.getObject(IntraVmJndiReference.java:39)
>>     [exec] at
>> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:171)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.fillInjectionProperties(SingletonInstanceManager.java:265)
>>     [exec] at
>> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:171)
>>     [exec] ... 30 more
>> .
>> .
>> .
>>
>>
>>
>> On Wed, Jul 7, 2010 at 3:34 AM, David Blevins <[hidden email]>wrote:
>>
>>>
>>> On Jun 24, 2010, at 12:48 PM, Thiago Veronezi wrote:
>>>
>>>> Hi, devs!
>>>> Im still alive... Im just having a good rush at work these days.
>>> Anyways, I
>>>> just found an opportunity to contribute for both projects. :O)
>>>
>>> :)
>>>
>>>> I've opened and fixed the following issue:
>>>> https://issues.apache.org/jira/browse/OPENEJB-1304
>>>> When you have time, please review this guy for me.
>>>
>>> Looks like there may be a startup ordering issue related to this added
>>> feature:
>>>
>>> https://issues.apache.org/jira/browse/OPENEJB-1296
>>>
>>> I committed the part of the patch that deals with avoiding calling
>>> PreDestroy on instances that where never created -- good catch!  The
>>> assembler fix that changes the sort order isn't quite right as it is
>>> essentially what we had before OPENEJB-1296, but clearly something along
>>> that lines will be needed.  I'm not sure if this will work, but I tried
>>> adding back in the "sort singletons to the back" sort but this time before
>>> the @DependsOn sort so the @DependsOn will still take precedence.  That's
>>> the theory anyway, not sure if the @DependsOn is a stable sort -- seem to
>>> recall it was slightly unstable -- and it may not do the trick.
>>>
>>> Any chance you can give it a whirl and let us know if it does the trick?
>>>
>>> Thanks for reporting this, Thiago!
>>>
>>>
>>> -David
>>>
>>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

dblevins
Administrator

On Jul 8, 2010, at 6:20 PM, David Blevins wrote:

> The only way to fix that issue is to make the sorting done in References stable, so it only makes changes in order necessary to enforce the references.
>
> Tricky bit of work indeed.  I added a couple test cases to ReferencesTest (_testNoReferences() and _testOrderedReferences()).  If we can get those to pass, we'll be in good shape.

Hey Ivan,

Saw your patch for the stable reference sorting (OPENEJB-1309).  Pretty great stuff!  It's better than Dain's algorithm -- those that know Dain know how much of a compliment that is.

Going to commit it right away.  As we chatted on IRC, turning the Node into linked list with previous/next would be a super great compliment to the way the code is written.  Looking forward to that patch, it's going to be excellent!

Thanks so much for all the great work!


-David

Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

Ivan Xu
Hi, David:
    Yes, using a double linked list is a good idea, it should improve the
efficiency much. I attached another patch to the OpenEJB-1309 JIRA. Please
help to review it, thanks !

2010/7/10 David Blevins <[hidden email]>

>
> On Jul 8, 2010, at 6:20 PM, David Blevins wrote:
>
> > The only way to fix that issue is to make the sorting done in References
> stable, so it only makes changes in order necessary to enforce the
> references.
> >
> > Tricky bit of work indeed.  I added a couple test cases to ReferencesTest
> (_testNoReferences() and _testOrderedReferences()).  If we can get those to
> pass, we'll be in good shape.
>
> Hey Ivan,
>
> Saw your patch for the stable reference sorting (OPENEJB-1309).  Pretty
> great stuff!  It's better than Dain's algorithm -- those that know Dain know
> how much of a compliment that is.
>
> Going to commit it right away.  As we chatted on IRC, turning the Node into
> linked list with previous/next would be a super great compliment to the way
> the code is written.  Looking forward to that patch, it's going to be
> excellent!
>
> Thanks so much for all the great work!
>
>
> -David
>
>


--
Ivan
Reply | Threaded
Open this post in threaded view
|

Re: Startup order (Re: patch for review

Thiago Veronezi
Hey, Ivan!
Thaks a lot man. I just tested the the last version of the server... and it
is running like a charm.
[]s,
Thiago.


On Sat, Jul 10, 2010 at 11:17 AM, Ivan <[hidden email]> wrote:

> Hi, David:
>    Yes, using a double linked list is a good idea, it should improve the
> efficiency much. I attached another patch to the OpenEJB-1309 JIRA. Please
> help to review it, thanks !
>
> 2010/7/10 David Blevins <[hidden email]>
>
> >
> > On Jul 8, 2010, at 6:20 PM, David Blevins wrote:
> >
> > > The only way to fix that issue is to make the sorting done in
> References
> > stable, so it only makes changes in order necessary to enforce the
> > references.
> > >
> > > Tricky bit of work indeed.  I added a couple test cases to
> ReferencesTest
> > (_testNoReferences() and _testOrderedReferences()).  If we can get those
> to
> > pass, we'll be in good shape.
> >
> > Hey Ivan,
> >
> > Saw your patch for the stable reference sorting (OPENEJB-1309).  Pretty
> > great stuff!  It's better than Dain's algorithm -- those that know Dain
> know
> > how much of a compliment that is.
> >
> > Going to commit it right away.  As we chatted on IRC, turning the Node
> into
> > linked list with previous/next would be a super great compliment to the
> way
> > the code is written.  Looking forward to that patch, it's going to be
> > excellent!
> >
> > Thanks so much for all the great work!
> >
> >
> > -David
> >
> >
>
>
> --
> Ivan
>