-
1. Re: how to initialize a stateless session bean in jboss 7?
wdfink Jan 15, 2012 12:41 PM (in response to sodarfish)1 of 1 people found this helpfulIt is the responsibillity of the container whether and when to create a SLSB. Here it will be created on first use.
I'm not sure whether there is an option to prefill a pool which create the beans. If I find time I'll have a look.
BTW what you try to achieve with this, the bean should be Stateless.
-
2. Re: how to initialize a stateless session bean in jboss 7?
ozizka Jan 15, 2012 4:48 PM (in response to sodarfish)1 of 1 people found this helpfulIn Java EE 5, there isn't a way to trigger a EJB on application deployment. There is a way for doing this in Java EE 6 with @Singleton @Startup beans.
For Java EE 5, the easiest way to get similar functionality is to package your application as a .ear with a .war module (web) and a EJB module. You can then have a ServletContextListener which will be triggered when the web application is deployed.
Also, search for "startup" (without the quotes) in this EJB forum and you will find some interesting discussions (on page 1 and 2) related to this.http://www.coderanch.com/t/517685/EJB-JEE/java/Deploy-or-application-start-up
-
3. Re: how to initialize a stateless session bean in jboss 7?
sodarfish Jan 18, 2012 9:49 AM (in response to wdfink)thanks for your reply! i have the same idea as yours, but i didn't find a way to prefill the pool in Jboss 7.x
I try to achieve with that because i want to prepare some (static) data before i use it.
-
4. Re: how to initialize a stateless session bean in jboss 7?
sodarfish Jan 18, 2012 9:59 AM (in response to ozizka)I tried that method and it works , thanks a lot for your help!
maybe the @Resource annotation can help me to initialize a bean? so that i can initialize some sharing data before use.
public class TheTriggerBean {
@Resource
ApplicationController applicationControllerBean;
.....
}