问题描述:
2012-4-6 22:25:42 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exceptionjava.lang.IllegalStateException: getInputStream() has already been called for this request
at org.apache.catalina.connector.Request.getReader(Request.java:1187)
at org.apache.catalina.connector.RequestFacade.getReader(RequestFacade.java:470)
at javax.servlet.ServletRequestWrapper.getReader(ServletRequestWrapper.java:248)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
...
问题原因及解决方案:
将对象转换为JSON格式时出错,解决方法保证转换成JSON数据的每个java对象可序列化,而Serializable就是java提供的通用数据保存和读取的接口。