geosolutions-it/mapfish-print

Could not resolve placeholder 'MAPFISH_PDF_FOLDER' in value "${MAPFISH_PDF_FOLDER}"

Opened this issue · 1 comments

Hello,

using this geoserver/print-lib/gs-printing version matrix following the 2.15.x documentation in wiki here

Software version
Geoserver 2.15.5
print-lib print-lib-2.0-SNAPSHOT.jar
gs-printing gs-printing-geosolutions-2.15-SNAPSHOT.jar

if I add the jars as per documentation and then wait for application re-deployment, or deploy a war with the jars added inside, I get:



14-Jul-2020 10:12:44.054 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.geoserver.platform.GeoServerContextLoaderListener]
 org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'printingWrapper' defined in URL [jar:file:/var/lib/tomcats/geoserver/webapps/geoserver/WEB-INF/lib/gs-printing-geosolutions-2.15-SNAPSHOT.jar!/applicationContext.xml]: Could not resolve placeholder 'MAPFISH_PDF_FOLDER' in value "${MAPFISH_PDF_FOLDER}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'MAPFISH_PDF_FOLDER' in value "${MAPFISH_PDF_FOLDER}"
        at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:228)
        at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:182)
        at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:157)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
        at org.geoserver.platform.GeoServerContextLoaderListener.contextInitialized(GeoServerContextLoaderListener.java:22)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:980)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1852)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'MAPFISH_PDF_FOLDER' in value "${MAPFISH_PDF_FOLDER}"
        at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
        at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)
        at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237)
        at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211)
        at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:296)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:217)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitMap(BeanDefinitionVisitor.java:275)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:211)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:147)
        at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:85)
        at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:225)
        ... 23 more

and then the application fails to start.

I managed to get geoserver up and running only by specifying a path for mapfish to save PDFs like:
-DMAPFISH_PDF_FOLDER=/tmp

Could it be possible to fix this behaviour, maybe setting a MAPFISH_PDF_FOLDER default instead of it not being present at all, in order to once the geoserver application si deployed throws no error even if the plugin is present with no configuration added in JAVA_OPTS ?

what do you think @mbarto ?