I have two configurations of Tomcat with the same version of GeoServer and the print module installed as below.

  • The old configuration is Tomcat 8.0.44/GeoServer 2.11.1
  • The new configuration is Tomcat 9.0.10/GeoServer 2.11.1

Using the old configuration I can POST to localhost:1080/geoserver/pdf/print.pdf in SoapUI with the spec file generated from the Print Module demo in the body and this returns a pdf. An application has been written in C# based around this method of generating a pdf.

Using the new configuration (as Tomcat 8.0.x is now end of life, and also a combination of Tomcat 8.5.32/GeoServer 2.11.1) the same POST returns an error message:

<data contentType="text/plain" contentLength="55"><![CDATA[Error while 
generating PDF:
Missing 'spec' parameter

If the POST is changed to a GET with ?spec={SPEC} then this works but for our actual application requirements a POST is the only way to ensure that all of the vector data gets sent to the print module.

Does anyone have experience of using Tomcat 8.5 or above with GeoServer's Print Module using a POST to print.pdf?

The default SPEC file that has been used in SOAPUI testing is

    "layout":"A4 portrait",
        "mapTitle":"A custom title",
        "comment":"A custom comment"

1 Answer 1


To get this working in Tomcat 9 I had to send the post data as

ContentType = "application/x-www-form-urlencoded";

and encoded the post json in JavaScript as

"spec=" + encodeUri(jsonObject)

or for my C# implementation i used

postData = "spec=" + HttpUtility.UrlEncode(jsonStr);
byte[] data = Encoding.ASCII.GetBytes(postData);
httpWebRequest.ContentLength = data.Length;
Stream requestStream = httpWebRequest.GetRequestStream();
requestStream.Write(data, 0, data.Length);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.