I have a problem with my EJB:
public class EntryResponseBuilder extends BaseResponseBuilder {
@EJB
private ApplicationCustomerCache applicationCustomerCache; //null
I have something like this in class that returns a JSON response.
@Singleton
@Startup
public class ApplicationCustomerCache {
@EJB
CustomerDao customerDao;
private Map<Integer, Customer> customerMap;
private Map<Integer, List<Customer>> applicationToCustomersMap;
private static Logger log = Logger.getLogger(ApplicationCustomerCache.class);
@PostConstruct
public void initialize() {
try {
get();
} catch (Exception e) {
log.error("ApplicationCustomerCache.init()", e);
}
}
private void get() throws SQLException {
And its working fine, except that when I try to get injection in EntryResponseBuilder
, it's empty. One function before, it inject, where I have class with @Stateless
. I've searched in Google, but I can not find any solution.
Your dealing with two issues here:
For both of them, I think the following answers can help you: