AnsweredAssumed Answered

Javascript syntax error on print map, only when feature count > 8000 (updated)

Question asked by DeathXIII on Jan 31, 2017

I am using arcgis jsapi v3.10, and esri/dijit/Print for my map printing. Version 10.2.0 for arcgis server. I am encountering an very weird bug where the browser return:

SyntaxError: Unexpected token < 
at Object.b.fromJson (init.js:231)
at Object.json (init.js:188)
at t (init.js:193)
at c (init.js:79)
at d (init.js:79)
at b.Deferred.resolve.callback (init.js:80)
at init.js:196
at k (init.js:200)
at r (init.js:200)
at f.resolve (init.js:202)

I've done multiple test while eliminating as much variables as possible. I print nothing except a point feature layer with simple maker symbol. As I slowly increases the feature count, I end up seeing the syntax error when the count reaches ~8200. I've also tried to use point from other layers just in case there are some data corruption in certain layer, but the results are similar.


One additional piece of information is that the 'print-start' event has been triggered and fully completed, whereas the 'print-complete' event never triggers due to the js error.


The print map function can do everything correctly including legends, scale, multiple layer, basemap e.t.c. when the feature count is low. Has anyone encounter similar issue? I suspect there might be some sort of feature count limit, but I couldn't find any related ESRI documentation so far.


Ok I've done some further digging. I basically add a log line into init.js to see what is it that triggers the syntax error. turns out that function expects a JSON response and I got a html page instead. The html page is a response from the print API and it says something like "error : WebMapAsJSON cannot be empty". I immediately check the outgoing request and verified that the WebMapAsJSON field is populated correctly. After more research online, it seems like that map server has its own maximum post content size limit and I've exceeded it. 


I've followed some instructions and change maxPostSize=0 to disable limitation for post size in C:\Program Files\ArcGIS\Server\framework\runtime\tomcat\conf\server.xml. However, another error pop-up after I retry the test case with the new settings. This time it is in the server error log "Internal Server Error. Error handling service request : Cannot write the request to the server:"

Is there some other settings I am still missing?