NullPointerException - CustomerState.setCustomer()
Posted: Fri Jul 04, 2014 12:46 pm
I am getting the following error while calling CustomerState.setCustomer();
Here is the following snippet of code that caused the error.
The problem is that, BroadleafRequestContext.getBroadleafRequestContext().getWebRequest() is null. How do I solve this?
Thanks in advance. Hope you will reply as soon as possible.
Code: Select all
java.lang.NullPointerException
at org.broadleafcommerce.common.web.BroadleafRequestCustomerResolverImpl.setCustomer(BroadleafRequestCustomerResolverImpl.java:62)
at org.broadleafcommerce.profile.web.core.CustomerState.setCustomer(CustomerState.java:52)
Here is the following snippet of code that caused the error.
Code: Select all
Customer c=CustomerState.getCustomer(request);
System.out.println("The current customer is "+c);
if(c==null)
{
c=new CustomerImpl();
c.setCookied(true);
c.setAnonymous(true);
}
System.out.println("After init "+c);
CustomerState.setCustomer(c);
The problem is that, BroadleafRequestContext.getBroadleafRequestContext().getWebRequest() is null. How do I solve this?
Thanks in advance. Hope you will reply as soon as possible.