Igor Urdenko [
http://community.jboss.org/people/ingvarwolf] created the discussion
"Interceptors on JBoss startup"
To view the discussion, visit:
http://community.jboss.org/message/641354#641354
--------------------------------------------------------------
Hi all,
I have joined a company which has developed a several EJB's (EJB 2.1) runnning under
JBoss 4.2.3.GA. My task is to migrate these EJBs (all of them just Stateless Session
Beans) from EJB 2.1 to EJB 3.0.
I have completed already an EJB migration and now I am in stack with interceptors. The
thing is we have one interceptor which extends org.jboss.ejb.plugins.AbstractInterceptor.
This interceptor initializes some of EJBs on JBoss startup. I have tried many approaches
but it looks like interceptors work *only* when an EJB created or it's method called.
I need an interceptor to be called at the moment EJB is statrted or after all EJBs has
been started and before my application starts work. I need this to initialize some
functionality.
I am not familiar with EJB 2.1 but it seems to me that interceptors work differently than
in EJB 3.0. In EJB 2.1 all interceptors are defined in standardjboss.xml, EJB 3.0 defines
them in ejb3-interceptors-aop.xml. I tried to create my interceptor and define it in both
files. I tried also to extend AbstractInterceptor, or implement
org.jboss.aop.advice.Interceptor, or use @AroundInvoke - @Interceptors annotation. But the
result is the same - my interceptor is not called on EJB start (that correspondes to the
"STARTED EJB" message in log but only when I create it directly and call a
method.
I have created a JBoss service which puts a notification listener that waits for JBoss
start and then creates EJBs I need. The required functionality implemented in static block
code, so it runs when I create the EJB. But it looks for me like incorrect solution.
Is there any solution for that?
Thank you
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/641354#641354]
Start a new discussion in EJB3 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]