I have a jax-rs service implemented with RestEasy, I am using Jboss as7 and have implemented a signleton ejb with the @Signleton annotation. The signleton is started when the server starts (@startup) and I would like to inject it into the jax-rs usign the @EJB. The problem is that the class is always null and I am started to get lost because in every tutorial I have looked this is the way they are injecting the ejb. Should I use any special xml file? what am I doing wrong?
@Path("/")
public class Service extends Application{
@EJB
private GlobalStore store;
public Service(){
fromejbstore = store.getSentiment();//null pointer is thrown
}
}
the Signleton ejb is:
@Singleton
@Startup
public class GlobalStore {
Sentiment sentiment;
@PostConstruct
public void initialize() {
//do something
}
public Sentiment getSentiment(){return sentiment;}
}