Geoserver 2.28.4 printing extension does not bring all needed dependencies

Hi,

I was putting a clean geoserver 2.28.4 up, only with stable printing extension, and it does not work out of the box because of missing dependencies.

Just run:

docker run -it -p 14080:8080   --env INSTALL_EXTENSIONS=true --env STABLE_EXTENSIONS="printing"   docker.osgeo.org/geoserver:2.28.4

Access url:

http://localhost:14080/geoserver/pdf/info.json

And you will have this error:

HTTP Status 500 – Internal Server Error
Type Exception Report

Message Error occurred while reading configuration file '/opt/geoserver_data/printing/config.yaml': 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: Error creating bean with name 'configFactory': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.mapfish.print.config.ConfigFactory] from ClassLoader [ParallelWebappClassLoader

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error occurred while reading configuration file '/opt/geoserver_data/printing/config.yaml': 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: Error creating bean with name 'configFactory': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.mapfish.print.config.ConfigFactory] from ClassLoader [ParallelWebappClassLoader
  context: geoserver
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@6438a396
]
	org.mapfish.print.servlet.BaseMapServlet.getMapPrinter(BaseMapServlet.java:145)
	org.mapfish.print.servlet.MapPrinterServlet.getInfo(MapPrinterServlet.java:320)
	org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:106)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:623)

The zipped extension on sourceforge (Download geoserver-2.28.4-printing-plugin.zip (GeoServer)) must bring also:

  • commons-httpclient:commons-httpclient-3.1
  • com.fasterxml.jackson.dataformat:jackson-dataformat-yaml-2.21.0
  • → snakeyaml (this will be a transitive dependency of jackson-dataformat-yaml)

My pom that works fine for me:

         <dependency>
            <!-- printing depdendency -->
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>2.21.0</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <!-- printing depdendency -->
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Cheers

Hi Tiago,
I believe the file that needs to be modifies is this one:

Can you make a PR? Target the 2.28.x branch directly, as on 3.0.x and main the assembly machinery changed, the file is in another place, and mapfish-print 2.5.x uses common http 5.x I believe. In any case, for reference, see here:

Cheers
Andrea