[jboss-user] [JBoss Seam] - NPE when logging inside a property getter

cyberanto do-not-reply at jboss.com
Tue Jan 29 11:10:36 EST 2008

I get a Nullpointer Exception when I add a log statement to my property getter. Example:

public class EditDataViewAction ...

skuSelectionAction() {
     Contexts.getSessionContext().set("skuModel", selectedSku);

public class SkuModel ...

@Logger private Log log;

private List features = new ArrayList();

// lazy loading
public List getFeatures() {
     if (features.size() < 1) {
          log.info("features.size() was smaller than 1");
          try {
	features.addAll(featureDao.getFeaturesByFeatureListId(featureListId, this));
	} catch (ServerException e) {
     return features;

Caused by: java.lang.NullPointerException
	at com....model.SkuModel.getFeatures(SkuModel.java:196)
	at com....view.EditDataViewAction.skuSelectionAction(EditDataViewAction.java:53)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

If I take out the log statement, this works just fine ... looks like the Logger has not been initialized at reflection time?

Seam version: 2.0.1.CR1

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124459#4124459

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124459

More information about the jboss-user mailing list