I’m new to EJB3 and I’ve the following problem.
I’m using jboss5.eap.
I have a service POJO (annotated with org.jboss.ejb3.annotation.Depends, org.jboss.ejb3.annotation.Service, javax.ejb.Local:
@Service
@Local(MyInterfaceService.class)
@Depends(“EJB Global JNDI name”)
public class MyService implements MyInterfaceService {
and I want to access a stateless EJB from the create() method of this Service POJO.
@EJB
private ITimer myEJBTimer;
My EJB is a multiple Timer Object using the TimerService object.
Deploying I get the following warning and errors:
2010-06-23 13:03:04,080 WARN [org.jboss.injection.EJBRemoteHandler] (main) EJBTHREE-1828: EJBInjectionContainer jboss.j2ee:ear=ear-name.ear,jar=jarname.jar,name=MyService,service=EJB3 is unconfigured, using legacy resolve
2010-06-23 13:03:04,502 ERROR [org.jboss.system.server.profileservice.ProfileServiceBootstrap] (main) Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:ear= ear-name.ear,jar= jarname.jar,name= MyService,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear= ear-name.ear,jar= jarname.jar,name= MyService,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'EJB Global JNDI name' **")
I understand that my stateless EJB will not yet be bound before my Service POJO create method is called.
I’ve tried several way of writing the annotation, with and without parameters with no success.
Obviously if I change my code into
InitialContext ctx = new InitialContext();
myEJBTimer = (ITimer) ctx.lookup("'EJB Global JNDI name' ");
I have no problems
My question is: Is it possible to make my code work with annotation?
Thanks.
ml