I'm rather newbie to JBoss and annotations. I have following code example. Irrelevant details are cutted out.
@Singleton
@Startup
public class SomeBean {
@Resource
TimerService timerService;
@Inject
AnotherSingleton anotherOne;
Timer timer;
@PostConstruct
private void ejbCreate() {
timer = timerService.createIntervalTimer(0, interval, tc);
}
@Timeout
public void run() throws Exception {
}
}
@Singleton
public class AnotherSingleton {
@Inject
Repository rep;
}
There is case that when war is deploying on JBoss it fails with exception from Repository producer (service in another Jboss is not available).
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
So process ends with
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."someservices-view.war".component.SomeBean.START
What options do i have? Can i tell JBoss to don't @Inject beans on startup but when code is executed by timer? Can i somehow catch exception? @Schedule is out of question becaouse i need to configure Timer.