The problem caused by the springMVC controller is not configured with multiple instances

The front end uses the MMGrid framework to write a list, but in the case of high concurrency, or when the page is refreshed continuously, MMgrid will prompt that the data is loaded abnormally. The developer does not know what is going on. NullException appears in the console, and a bunch of errors:
java .lang.NullPointerException
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:216)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:460)
at org.apache.tomcat .util.buf.ByteChunk.append(ByteChunk.java:368)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:241)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite (ChunkedOutputFilter.java:119)
at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192)
at org.apache.coyote.Response.doWrite(Response.java:533)
At org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:373),
check this error carefully, and find that the object ID of the error is the same. Obviously, when outputting, because the same instance is outputting IO, it is too late After writing, an error occurs. The solution is very simple. Add @Scope("prototype") to the controller to make the controller multi-instance. In fact, when the controller is done, it is recommended to set it to multi-instance. , single instance operation, it is easy to generate errors

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487099&siteId=291194637