[Geoserver-users] Geoserver 2.22.0 with printing extension

Hi,

I’m trying to upgrade geoserver 2.21 to 2.22 and I’m getting an error when I try to use the printing extension.

Environment:

  • Java 8 (I’ve looked at some JARs manifest and it still have jdk1.8)
  • Tomcat 8.5.37

I’m running geoserver.war out-of-box, just adding geoserver printing JARs to the WEB-INF/lib.
Geoserver starts, but when i invoke “https://localhost/geoserver/pdf/info.json” it throws this error:

geoserver | 16 Jan 16:28:19 ERROR [servlet.BaseMapServlet] - Error occurred while reading configuration file
geoserver | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘mapPrinter’: Unsatisfied dependency expressed through field ‘configFactory’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘configFactory’: Unsatisfied dependency expressed through field ‘threadResources’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘threadResources’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.mapfish.print.ThreadResources] from ClassLoader [ParallelWebappClassLoader
geoserver | context: geoserver
geoserver | delegate: false
geoserver | ----------> Parent Classloader:
geoserver | java.net.URLClassLoader@anonymised.com
geoserver | ]
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
geoserver | at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
geoserver | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:342)
geoserver | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:227)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1175)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveBean(DefaultListableBeanFactory.java:420)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:349)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:342)
geoserver | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1127)
geoserver | at org.mapfish.print.servlet.BaseMapServlet.getApplicationContext(BaseMapServlet.java:158)
geoserver | at org.mapfish.print.servlet.BaseMapServlet.getMapPrinter(BaseMapServlet.java:137)
geoserver | at org.mapfish.print.servlet.MapPrinterServlet.getInfo(MapPrinterServlet.java:279)
geoserver | at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:99)
geoserver | at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
geoserver | at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

Any ideas?

Thanks in advance,

···

Tiago Vieira

Tiago:

I made a custom fork of mapfish-print since the library is no longer really maintained (a newer version 3 makes use of Jasper Reports and has a different use-case in mind).

The fork was required as mapfish version 2.x made use of a library that was no longer open source. My expectation is that the jar required by mapfish print 2.22.0 is not included in GeoServer and it is unable to work.

I think we also looked at the logging configuration so mapfish-print did not immediately include the old log4j1.2 API, as we now make use of Log4j 2.x.

From src/extension/printing/pom.xml:

org.mapfish.print
print-lib


log4j
log4j


If you are comfortable working in a development environment I would be happy to answer questions as you dig into this further.

I do ask that you check the issue tracker and report this issue if it has not already been done.

Jody

I cannot immediately tell from the stack trace you provided what is missing.

···


Jody Garnett

It looks like this issue is reported already
https://osgeo-org.atlassian.net/browse/GEOS-10815

Jody

···


Jody Garnett

Hi Jody,
Thanks for your reply.

I made a custom fork of mapfish-print since the library is no longer really maintained (a newer version 3 makes use of Jasper Reports and has a different use-case in mind).

I tried to use this version (3.x) a few years ago, but it didn’t have support for GoogleMaps, and exporting features from a vector layer to PDF didn’t came as vector on PDF.
Any news about these two features?

The fork was required as mapfish version 2.x made use of a library that was no longer open source. My expectation is that the jar required by mapfish print 2.22.0 is not included in GeoServer and it is unable to work.

That library could be “commons-httpclient-3.1.jar” from below dependency? If not, it may be added to the zip printing libs on geoserver extensions downloads section, and update the pom file to bring that dependency also.
commons-httpclient
commons-httpclient
I just added that Jar to geoserver lib and everything seems to work. I’ll run more tests.

Cheers

···

Tiago Vieira

Excellent! So how did your testing go?

I am taking some notes here https://osgeo-org.atlassian.net/browse/GEOS-10835

Jody

On Tue, Jan 17, 2023 at 4:48 PM Tiago Vieira <tixvieira@anonymised.com> wrote:

Hi Jody,
Thanks for your reply.

I made a custom fork of mapfish-print since the library is no longer really maintained (a newer version 3 makes use of Jasper Reports and has a different use-case in mind).

I tried to use this version (3.x) a few years ago, but it didn’t have support for GoogleMaps, and exporting features from a vector layer to PDF didn’t came as vector on PDF.
Any news about these two features?

The fork was required as mapfish version 2.x made use of a library that was no longer open source. My expectation is that the jar required by mapfish print 2.22.0 is not included in GeoServer and it is unable to work.

That library could be “commons-httpclient-3.1.jar” from below dependency? If not, it may be added to the zip printing libs on geoserver extensions downloads section, and update the pom file to bring that dependency also.
commons-httpclient
commons-httpclient
I just added that Jar to geoserver lib and everything seems to work. I’ll run more tests.

Cheers

Tiago Vieira

On Tue, 17 Jan 2023 at 01:31, Jody Garnett <jody.garnett@anonymised.com> wrote:

It looks like this issue is reported already
https://osgeo-org.atlassian.net/browse/GEOS-10815

Jody

On Mon, Jan 16, 2023 at 4:58 PM Jody Garnett <jody.garnett@anonymised.com> wrote:

Tiago:

I made a custom fork of mapfish-print since the library is no longer really maintained (a newer version 3 makes use of Jasper Reports and has a different use-case in mind).

The fork was required as mapfish version 2.x made use of a library that was no longer open source. My expectation is that the jar required by mapfish print 2.22.0 is not included in GeoServer and it is unable to work.

I think we also looked at the logging configuration so mapfish-print did not immediately include the old log4j1.2 API, as we now make use of Log4j 2.x.

From src/extension/printing/pom.xml:

org.mapfish.print
print-lib


log4j
log4j


If you are comfortable working in a development environment I would be happy to answer questions as you dig into this further.

I do ask that you check the issue tracker and report this issue if it has not already been done.

Jody

I cannot immediately tell from the stack trace you provided what is missing.


Jody Garnett

On Mon, Jan 16, 2023 at 8:43 AM Tiago Vieira <tixvieira@anonymised.com> wrote:

Hi,

I’m trying to upgrade geoserver 2.21 to 2.22 and I’m getting an error when I try to use the printing extension.

Environment:

  • Java 8 (I’ve looked at some JARs manifest and it still have jdk1.8)
  • Tomcat 8.5.37

I’m running geoserver.war out-of-box, just adding geoserver printing JARs to the WEB-INF/lib.
Geoserver starts, but when i invoke “https://localhost/geoserver/pdf/info.json” it throws this error:

geoserver | 16 Jan 16:28:19 ERROR [servlet.BaseMapServlet] - Error occurred while reading configuration file
geoserver | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘mapPrinter’: Unsatisfied dependency expressed through field ‘configFactory’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘configFactory’: Unsatisfied dependency expressed through field ‘threadResources’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘threadResources’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.mapfish.print.ThreadResources] from ClassLoader [ParallelWebappClassLoader
geoserver | context: geoserver
geoserver | delegate: false
geoserver | ----------> Parent Classloader:
geoserver | java.net.URLClassLoader@anonymised.com
geoserver | ]
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660)
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
geoserver | at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
geoserver | at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1425)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
geoserver | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
geoserver | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:342)
geoserver | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:227)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1175)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveBean(DefaultListableBeanFactory.java:420)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:349)
geoserver | at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:342)
geoserver | at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1127)
geoserver | at org.mapfish.print.servlet.BaseMapServlet.getApplicationContext(BaseMapServlet.java:158)
geoserver | at org.mapfish.print.servlet.BaseMapServlet.getMapPrinter(BaseMapServlet.java:137)
geoserver | at org.mapfish.print.servlet.MapPrinterServlet.getInfo(MapPrinterServlet.java:279)
geoserver | at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:99)
geoserver | at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
geoserver | at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

Any ideas?

Thanks in advance,

Tiago Vieira


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Jody Garnett

We’ve printing and other geoserver plugins, and everything is running fine.

All our web automated tests passed, so it seems this problem is solved for this version.

Did you saw my other question?

I made a custom fork of mapfish-print since the library is no longer really maintained (a newer version 3 makes use of Jasper Reports and has a different use-case in mind).

I tried to use this version (3.x) a few years ago, but it didn’t have support for GoogleMaps, and exporting features from a vector layer to PDF didn’t came as vector on PDF.
Any news about these two features?

Thanks

···

Tiago Vieira

No idea, you would have to ask the mapfish project. It is unlikely that google maps anything would work as they locked down their api a while back.

···


Jody Garnett

Thanks!

···

Tiago Vieira