Hi,
I have a piece of code that I would like to port from JBoss to TomEE.
The old code, which was working on JBoss, is like that. Inside the same EAR
folder I have:
- EJB jar (with EJBs and timers)
- WAR (web application, with 1 EJB)
I have a requirement that the ejb timers (a method annotated with @Schedule)
will perform a task every X seconds.
This method calls an EJB (inside the jar) that will call another EJB, but
this time in a WAR application.
Basically the EJB in the jar has something like that:
@PostConstruct
public void init() {
log.info("INIT-BROADCASTERS");
try {
warBroadcaster = (BroadcasterBeanLocal) initialContext
.lookup("java:app/pn-test/WarBroadcasterBean");
} catch (NamingException e) {
log.error("Problem looking up for broadcasters", e);
}
}
This approach seems to not work on TomEE. I have tried to add:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
final InitialContext initialContext = new InitialContext(p);
But still it can't find the bean. I don't know if it's possible to do
something like that but anyway if you have any suggestions or different
approach I would be very keen to refactor this code to make it work
properly on TomEE.
Thanks in advance,
Luca