tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiago Veronezi (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (OPENEJB-1304) Singleton bean @PostConstruct method is called before stateless beans are initialized.
Date Sun, 01 Aug 2010 23:27:17 GMT

     [ https://issues.apache.org/jira/browse/OPENEJB-1304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thiago Veronezi resolved OPENEJB-1304.
--------------------------------------

    Resolution: Not A Problem

We should use the dependsOn feature.

http://openejb.979440.n4.nabble.com/patch-for-review-td2267551.html#a2267551


> Singleton bean @PostConstruct method is called before stateless beans are initialized.
> --------------------------------------------------------------------------------------
>
>                 Key: OPENEJB-1304
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1304
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: 2.6.32-22-generic linux, sun jdk 1.6.0_20-b02
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1304.patch
>
>
> The applicationInitialization method below fails at the bean initialization. The openEjb
server throws a
> .
> .
> .
>     [exec] Application could not be deployed:  /home/boto/Desktop/galileo/ws_sync1/iroot/target/system/ejbs/iservice.jar
>      [exec] org.apache.openejb.OpenEJBException: Creating application failed: /home/boto/Desktop/galileo/ws_sync1/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)
> .
> .
> .
> @Singleton
> @Startup
> @Local(IApplicationService.class)
> public class ApplicationImpl implements IApplicationService {
> 	private static final Logger LOG = Logger.getLogger(ApplicationImpl.class);
> 	
> 	@EJB
> 	private IUserServiceLocal iusr;
> 	
> 	@Override
> 	@PostConstruct
> 	public void applicationInitialization() {
> 		if (LOG.isInfoEnabled()) {
> 			LOG.info("Starting up the iserver EJB application...");
> 		}
> 		
> 		User root = iusr.findByAccount("root");
> 		if(root == null) {
> 			if (LOG.isInfoEnabled()) {
> 				LOG.info("This is the first execution! "
> 						+ "Creating the default root user.");
> 			}
> 			root = iusr.create("root", "root user", "1234");
> 		}
> 	}
> 	@Override
> 	@PreDestroy
> 	public void applicationShutdown() {
> 		// do nothing
> 	}
> }

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


Mime
View raw message