GeoServer - Print Module extension error

The Print Module extension was installed in GeoServer 2.27.1 (the same release).
After restarting, GeoServer created the configuration file “%GEOSERVER_DATA_DIR/printing/config.yaml”.
The next step in the installation verification is the listing of module parameters - http://localhost/geoserver/pdf/info.json.
However, it ends with error 500: Error occurred while reading configuration file %GEOSERVER_DATA_DIR\printing\config.yaml.

Environment:

  • OS: Microsoft Windows 2022 Server Standard
  • Java: jdk-17.0.13.11
  • Apache Tomcat: 9.0.105
  • GeoServer: 2.27.1 (servlet in Tomcat)
  • Print Module: 2.27.1

Does anyone have an idea to solve this problem?

We had to change yaml parsers during an upgrade and the new one is more strict! Please check the yaml file formatting. Maybe the template is out of date.

Hi jive!
I’m newbie in YAML.
Can you send me a valid (for Print Module 2.27.1) initial “config.yaml” template?
Thanks in advance.
Romanus

I also have this problem and don’t have a solution.
For anyone who can help, here’s part of the stack trace related to YAML:

05 Jun 19:45:40 ERROR [servlet.BaseMapServlet] - Error occurred while reading configuration file
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘mapPrinter’: Unsatisfied dependency expressed through field ‘configFactory’; nested exception is org.springframework.beans.factory.BeanCreationException:

Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.mapfish.print.config.ConfigFactory] from ClassLoader [ParallelWebappClassLoader
context: geoserver
delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@49097b5d
]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:485)
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:276)
... 133 more
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/dataformat/yaml/YAMLFactory
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:467)
... 135 more
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.dataformat.yaml.YAMLFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185)
... 139 more

Hi @Romanus

The documentation has examples:

Can also look at the example used by geoserver tests (so we know it loads):

You can also try a yaml checker to check formatting:

Please report back what you find so we can learn

Hi @Pamc your problems seems a little different the jars in your copy of geoserver are not matching.

Q: Please conform the version numbers of geoserver and printing extension are the same.

Yes. GeoServer version 2.27.1. Printing extension gs-printing-2.27.1.jar, print-lib-2.3.3.jar.
Java 17.0.11. Apache Tomcat 8.5.40.
The initial error message I received was the same as Romanus: 500/Internal Server Error: Error occurred while reading configuration file ‘{my_local_geoserver_datadir}/printing/config.yaml’.
Curious about this line in the stack trace:

NoClassDefFoundError: com/fasterxml/jackson/dataformat/yaml/YAMLFactory

There is no apparent corresponding jar in the lib directory for YAML, only for XML (jackson-dataformat-xml-2.18.2.jar).

Blah, wonder why that is passing tests during the build and then not being bundled correctly (sigh).

Let us have a look:

The printing is provided by mapfish 2.3.3 which does change jackson:

  • Update jackson from 2.17.2 to 2 2.18.2

What does GeoServer 2.27.1 included src/pom.xml?

Double checking GeoServer uses this latest release:

    <mf.version>2.3.3</mf.version>

And Jackson 2.18.2 which is the same as map fish above:

    <jackson1.version>1.9.13</jackson1.version>
    <jackson2.version>2.18.2</jackson2.version>
    <jackson2.databind.version>${jackson2.version}</jackson2.databind.version>

As for com/fasterxml/jackson/dataformat/yaml/YAMLFactory, geoserver is using:

      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${jackson2.version}</version>
      </dependency>

Those version numbers match - so it should be working. So YAMLFactory it should be available :frowning:

I am running out of ideas on this one…

As far as I remember, the YAML factory is contained in this jar:
https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml

It’s separate, because it comes with extra dependencies.
I don’t see the printing module assembly including that jar , nor its dependencies… look like it’s still referring some jyaml jar instead?

Cheers
Andrea

Thanks for that direction. I was able to view the info.json file after adding these jar files to the lib directory:

  • jackson-dataformat-yaml-2.18.2.jar (as suggested)
  • snakeyaml-2.3.jar (listed as dependency for above)
  • commons-httpclient-3.1.jar (added after receiving another “ClassNotFoundException” after adding above two files: “Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.MultiThreadedHttpConnectionManager”)
1 Like

After adding jackson-dataformat-yaml-2.18.2.jar, snakeyaml-2.3.jar and commons-httpclient-3.1.jar, “info.json” is finally displayed correctly.

Thanks @Pamc for the excellent problem solving!

New to GeoServer, so unsure what (if any) next steps are. If this is a build/bundling/dependency issue, is there another bug/issue tracking forum where I should submit this?

New to GeoServer, so unsure what (if any) next steps are. If this is a build/bundling/dependency issue, is there another bug/issue tracking forum where I should submit this?

Yes this is a user forum and not an issue tracker :slight_smile:

  • The issue tracker instructions are here: Issue tracker - GeoServer
  • This thread I think has enough information to confirm the issue and submit a ticket