-
1. @Service annotated bean lifecycle methods
jaikiran Feb 20, 2011 8:19 AM (in response to piotrekde)Can you post more info, including the logs, the actual code and a bit about your packaging? Also, which version of JBoss AS is this?
-
2. Re: @Service annotated bean lifecycle methods
piotrekde Feb 20, 2011 2:45 PM (in response to jaikiran)Thanks Jaikiran for the answer. I tried to simplify this issue as most as it is possible. So here is my service bean:
@Service public class RemoteTrafficManagerBean implements RemoteTrafficManager { public void start() throws Exception { System.out.println("Starting service bean"); clearStatistics(); } public void create() throws Exception { System.out.println("Creating service bean"); } (... some other methods ...) public void someBusinessMethod() { (...) } }
Logs about starting/creating this bean are otputed to the standard out to make sure that it is not logging issue. RemoteTrafficManager is injected into another session bean using @EJB annotation. Also, someBusinessMethod is called from this bean. I am sure that RemoteTrafficManagerBean was instantiated, because some additional logging is flushed into console from its business methods (they do not work appropriately because initialization has not been done).
I 've put logging from all levels into file:
msc@nitrogen:~> cat jboss\ service\ logs |grep 'Starting service bean'
msc@nitrogen:~> cat jboss\ service\ logs |grep 'Creating service bean'
But there is no entry about starting/creating RemoteTrafficManagerBean. I use JBoss 5.0.0 with HornetQ.
-
3. Re: @Service annotated bean lifecycle methods
jaikiran Feb 20, 2011 8:54 PM (in response to piotrekde)piotrekde wrote:
Please do not use JBoss AS 5.0.0. Instead use JBoss AS 5.1.0 and then apply our latest EJB3 plugin http://www.jboss.org/ejb3/ejb3plugin.html on top of it.
There have been numerous fixes after JBoss AS 5.0.0 (including changes in this @Service area).
-
4. @Service annotated bean lifecycle methods
piotrekde Mar 2, 2011 2:53 PM (in response to jaikiran)Thanks for answer Jaikiran,
Unfortunately I cannot switch JBoss version (politics...). Anyway, I've solved this issue by moving initialization code into @Service constructor. Of course it is not possible in all cases (order of injection / initialization), however in my case it works fine.
Thanks,
Piotr.