hmm, I had transferred a couple of DAOs from another project which had been using commons
logging.
After replacing all my commons logging imports with seam.log.Log, all hell is breaking
loose ...
e.g.
==========================================
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.log.Log;
@Name("applicationCache")
@Scope(APPLICATION)
public class SwcmApplicationCache implements Serializable {
@Logger private Log log;
CategoryDAO categoryDao = new CategoryDAO();
public String refreshCategories() {
String outcome = ActionOutcomes.SUCCESS;
try {
categories.clear();
categories.addAll(categoryDao.getAllCategories());
staleCategory = false;
} catch (ServerException e) {
e.printStackTrace();
outcome = ActionOutcomes.FAILURE;
}
log.info("updating application cache categories outcome: "+outcome);
return outcome;
}
...
}
============================================
@Name("categoryDao")
public class CategoryDAO extends AbstractDAO {
@Logger private Log log;
public ArrayList getAllCategories() throws ServerException {
...
System.out.println("Logger is: "+log);
log.info("#0 categories returned ...", categories.size());
return categories;
}
}
bombs on Line 55 - the log.info() in the CategoryDAO ... (categories is NOT null) ...
14:39:56,171 INFO [STDOUT] Logger is: null
Caused by: java.lang.NullPointerException
at com.jostens.swcm.sql.CategoryDAO.getAllCategories(CategoryDAO.java:55)
at
com.jostens.swcm.application.SwcmApplicationCache.refreshCategories(SwcmApplicationCache.java:68)
Unless someone can tell me what I am doing wrong, I may have to replace all my logging
with System.out.print()'s ...
I am using JBOSS Developer Studio and set up my project using its ejb wizard. The SEAM
Logger works fine in some other classes ...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125667#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...