tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marius Kruger <ama...@gmail.com>
Subject @Singleton @PostActivate
Date Thu, 20 May 2010 12:19:06 GMT
Hi,

I'm trying to run stuff from a @Singleton after the ejb container started up.

I first tried to use @PostConstruct, but that requires you to specify
all dependent ejbs with @DependsOn,
but I don't know at compile time which ejbs I need to depend on.

Then I tried to get my @PostConstruct method to call a @Asynchronous
method with the hopes that
it will only be called after the ejb container started up completely
(and I can access any ejbs I want).
@Asynchronous in openejb does not seem to do what I want at the moment.
( http://openejb.979440.n4.nabble.com/Re-Asynchronous-not-working-for-me-td1049634.html
)

Then I tried to use @PostActivate in my @Singleton but it gives the
exception below.

(using openejb-ejbd-3.1.3-20100511.150338-18.jar )

--
2010-05-20 14:09:31,519:ERROR	FATAL ERROR: Unknown error in Assembler.
 Please send the following stack trace and this message to
users@openejb.apache.org :
 java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:131)
	at java.util.AbstractList.add(AbstractList.java:91)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processCallbacks(AnnotationDeployer.java:2080)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1069)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:680)
	at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
	at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:612)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:562)
	at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:391)
	at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:300)
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
	at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getEjbContext(OrchestrationEngineFactory.java:38)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:94)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:85)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getOrchestrationEngine(OrchestrationEngineFactory.java:124)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.open(OrchestrationEngineFactory.java:104)
	at za.co.enerweb.ebr.EbrContextListener.contextInitialized(EbrContextListener.java:25)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

2010-05-20 14:09:31,524:FATAL	OpenEJB has encountered a fatal error
and cannot be started: Assembler failed to build the container system.
org.apache.openejb.OpenEJBException:
java.lang.UnsupportedOperationException: null
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:293)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
	at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getEjbContext(OrchestrationEngineFactory.java:38)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:94)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:85)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getOrchestrationEngine(OrchestrationEngineFactory.java:124)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.open(OrchestrationEngineFactory.java:104)
	at za.co.enerweb.ebr.EbrContextListener.contextInitialized(EbrContextListener.java:25)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:131)
	at java.util.AbstractList.add(AbstractList.java:91)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processCallbacks(AnnotationDeployer.java:2080)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1069)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:680)
	at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
	at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:612)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:562)
	at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:391)
	at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:300)
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
	... 37 more
2010-05-20 14:09:31,528:ERROR	Could not instantiate an initial context
for looking up our ejb.
javax.naming.NamingException: Attempted to load OpenEJB.
java.lang.UnsupportedOperationException: null [Root exception is
org.apache.openejb.OpenEJBException:
java.lang.UnsupportedOperationException: null]
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:55)
	at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getEjbContext(OrchestrationEngineFactory.java:38)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:94)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:85)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getOrchestrationEngine(OrchestrationEngineFactory.java:124)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.open(OrchestrationEngineFactory.java:104)
	at za.co.enerweb.ebr.EbrContextListener.contextInitialized(EbrContextListener.java:25)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.apache.openejb.OpenEJBException:
java.lang.UnsupportedOperationException: null
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:293)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
	at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
	at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
	... 26 more
Caused by: java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:131)
	at java.util.AbstractList.add(AbstractList.java:91)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.processCallbacks(AnnotationDeployer.java:2080)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:1069)
	at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:680)
	at org.apache.openejb.config.AnnotationDeployer.deploy(AnnotationDeployer.java:194)
	at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:248)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:612)
	at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:562)
	at org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:391)
	at org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:300)
	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
	... 37 more
20 May 2010 2:09:31 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener
instance of class za.co.enerweb.ebr.EbrContextListener
java.lang.NullPointerException
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:94)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:85)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getOrchestrationEngine(OrchestrationEngineFactory.java:124)
	at za.co.enerweb.ebr.oe.OrchestrationEngineFactory.open(OrchestrationEngineFactory.java:104)
	at za.co.enerweb.ebr.EbrContextListener.contextInitialized(EbrContextListener.java:25)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
20 May 2010 2:09:31 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart

-- 
thanks
<>< Marius ><>

Mime
View raw message