It was because my resource bundle was only a POJO and not a managed bean and I could not inject using @EJB
. I had to look it up using JNDI.
Here is the code:
try {
Context ctx = new InitialContext();
ArticleLclFacade arBean = (ArticleLclFacade) ctx.lookup("java:global/gtest/ArticleLclFacade");
List<ArticleLcl> articles = arBean.getArticles(language);
for(Iterator<ArticleLcl> it = articles.iterator(); it.hasNext();){
ArticleLcl article = it.next();
messages.put(article.getArId().getArId().toString(), article.getArTitle());
}
} catch (NamingException ex) {
Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);
}