Hello,
I've got a very weird problem, as my code runs on my computer, but doesn't work on others. So, I have a timer bean with a local interface:
@Stateless
@Local(MyTimerLocal.class)
public class MyTimer implements MyTimerLocal {
private @Resource SessionContext ctx;
(...)
@Timeout
public void timeoutHandler(Timer timer) { } }
I also have a service bean. I would like to inject the timer bean into my service bean, to be able to start the timer to do some cron-like action.
So I've got:
@Service
@Local(MyServiceLocal.class)
@Remote(MyServiceRemote.class)
public class MyService implements MyServiceLocal, MyServiceManagement, MyServiceRemote {
(...)
@EJB
private MyTimerLocal timer;
(...) } }
This works without any problems on my computer. On others however, during startup I get the exception:
java.lang.RuntimeException: Unable to @Inject jndi dependency: timer into field private myservice.MyTimerLocal myservice.MyService.timer of class myservice.MyService
at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:50)
(...)
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: myservice.MyTimerLocal not bound]
(...)
Later, when I go check the jndi view on the jmx-console, I see that there is a myservice.MyTimerLocal binding. So my only guess is that somehow the timer bean on my computer gets deployed before the service bean, and on others the order is different. Can I explicitly specify the order in which beans get deployed? Maybe there's another explanation?
--
Adam
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3887975#3887975
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3887975
|