[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-04-01 Thread tpawankumar
Hi oskar/wolfc

I have tried both options suggested by you but it is not working.
Following is the code of my stateless bean

  | @Service
  | @Stateless
  | @Remote(ConfigService.class)
  | @Local(ConfigService.class)
  | public class ConfigServiceBean implements ConfigService {
  | 
  | 
  | @PostConstruct
  | public void test(){
  | System.out.println(Called test);
  | }
  | 
  | /**
  | *some methods inside this bean
  | **/
  | }
  | 


The method test() is not getting called when it is deployed.
Server i am using is Jboss 4.2.1 GA.
The method is getting called when first request is sent to the bean.

Please let me know if i miss something.

Please help me.

Thanks,
Pavan 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4140454#4140454

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4140454
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-04-01 Thread oskar.carlstedt
Hi!

When annotating with the service you have four life cycle methods that you can 
implement.

*create
*start
*stop
*destroy

Try call test from start and you'll se that it will be called.

Cheers
/Oskar



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4140493#4140493

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4140493
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-04-01 Thread oskar.carlstedt
Here is a short eaxample:


  | @Service
  | @Management(MyServiceManagement.class)
  | @Depends(jboss.ws:service=DeployerInterceptorEJB3)
  | public class MyService implements MyServiceManagement {
  | 
  |private Timer timer = null;
  | 
  |@Resource
  |private EJBContext ejbContext;
  | 
  |public void start() throws Exception {
  |   timer = ejbContext.getTimerService().createTimer(1000, Say Hello!!);
  |}
  | 
  |@Timeout
  |public void timeout(Timer timer) {
  |   System.out.println(timer.getInfo());
  |   timer = ejbContext.getTimerService().createTimer(1000, Say Hello 
again!!);
  |}
  | 
  |public void stop() {
  |   timer.cancel();
  |}
  | }
  | 
  | 
  | public interface MyServiceManagement {
  | 
  | public void start() throws Exception;
  | 
  | public void stop() throws Exception;
  | }
  | 
  | 
  | 


/Oskar

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4140503#4140503

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4140503
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-02-04 Thread wolfc
I'm planning to change this behavior in light of EJB 3.1. The supported way 
will be to use @PostConstruct in a @Singleton.
So for now I would say use @PosConstruct in a @Service bean.
Note that the create, start, stop, destroy methods will become deprecated and 
might disappear completely.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4126183#4126183

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4126183
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-02-04 Thread [EMAIL PROTECTED]
Hi All,
I got this problem resolved for EJB3 by creating a sar which calls the 
SessionBean and packaging with my ear as well explained in this link.

http://www.tomlauren.com/weblog/archives/14.html

When EJB3.1 is officially released I can think of other options.
Thanks for all your help.



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4126198#4126198

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4126198
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-02-03 Thread oskar.carlstedt
Hi All!

Important to know. An ejb is NOT started just because it is deployed. It is 
just available to a client through the application server. There is no method 
invoked on an ejb during or just after the deploy.

Ok, there are ways to go around this. Add a service to your ejb that is 
invoking your ejb. Use the @Service-annotation and then you get methods like 
start(), stop() create() and destroy().

Kind regards!
/Oskar



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4125893#4125893

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4125893
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-02-02 Thread [EMAIL PROTECTED]
I think I m using ejb timer service.
Pl. see my code.
Can you provide me with an example please.
Thanks


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4125756#4125756

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4125756
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [EJB 3.0] - Re: How to start a session bean as soon as it is deployed

2008-02-01 Thread ragavgomatam
Use ejb Timer Service

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4125725#4125725

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4125725
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user