I am trying to use Session
in Struts 2:
private Map<String, Object> session = ActionContext.getContext().getSession();
But I'm getting this error:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"com.opensymphony.xwork2.ActionContext.getSession()" because the return value of
"com.opensymphony.xwork2.ActionContext.getContext()" is null
I tried to use SessionMap
of Struts but still got the same error message. I have tried changing the struts-core
libraries and also tried a few solutions from Google but still doesn't solve this issue.