I am getting following Error: java.lang.IllegalStateException: getInputStream() has already been called for this request while implementing JSON with Struts2. Exception:
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException:
java.lang.reflect.InvocationTargetException
org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:230)
org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94)
org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115)
org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:197)
org.apache.struts2.json.JSONResult.execute(JSONResult.java:170)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374)
...........
java.lang.IllegalStateException: getInputStream() has already been called for this request
org.apache.catalina.connector.Request.getReader(Request.java:1242)
org.apache.catalina.connector.RequestFacade.getReader(RequestFacade.java:506)
javax.servlet.ServletRequestWrapper.getReader(ServletRequestWrapper.java:212)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:210)
org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
org.apache.struts2.json.JSONWriter.add(JSONWriter.java:355)
org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:215)
org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94)
org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115)
org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:197)
org.apache.struts2.json.JSONResult.execute(JSONResult.java:170)
.........
Kindly help me with this Error as I am stuck with this issue I have few question: I have implemented ServletRequestAware and using the same to get the userLocale. Is it conflicting with the JSONWriter Object.