Reputation: 1
The app uses Spring Framework and it needs to have a environment variable named config.path, this can be configured at a file named web.xml. It looks like this:
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<!-- *** Opcional, si no se quiere arrancar la aplicación con ninguna JAVA_OPT *** -->
<!-- context-param>
<param-name>config.path</param-name>
<param-value>ruta_absoluta_carpeta_ficheros_configuracion</param-value>
</context-param-->
<listener>
<listener-class>es.mpt.dsic.inside.ws.configuration.ConfigLoaderListener</listener-class>
</listener>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>file:${config.path}/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:es/mpt/dsic/inside/context/inside-ws-context.xml,
/WEB-INF/mvc-dispatcher-servlet.xml,
classpath:es/mpt/dsic/inside/context/inside-security-context.xml,
classpath:es/mpt/dsic/inside/context/inside-context.xml
</param-value>
</context-param>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
<!-- Spring MVC -->
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Spring encoding obligando a utf-8 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Firma Trifasica -->
<servlet>
<description>Servicio de firma electronica en 3 fases v2.1</description>
<servlet-name>SignatureService</servlet-name>
<servlet-class>es.gob.afirma.triphase.server.SignatureService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SignatureService</servlet-name>
<url-pattern>/SignatureService</url-pattern>
</servlet-mapping>
And I set it like this:
<context-param>
<param-name>config.path</param-name>
<param-value>/var/lib/tomcat8/webapps/aplicacion/resources/config</param-value>
</context-param>
Mi problem is that if I let those lines commented and try to deploy the app, I get this error at catalina.out:
INFORMACIÓN: Despliegue del archivo /var/lib/tomcat8/webapps/inside.war de la aplicación web abr 25, 2017 1:51:12 PM org.apache.jasper.servlet.TldScanner scanJars INFORMACIÓN: Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP . DEBUG: setDebug: JavaMail version 1.4ea 13:51:16,880 ERROR ContextLoader:308 - Context initialization failed java.lang.IllegalArgumentException: Could not resolve placeholder 'config.path' at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:173) at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:125) at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:151) at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:142) at org.springframework.core.env.AbstractEnvironment.resolveRequiredPlaceholders(AbstractEnvironment.java:440) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:188) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:149) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:126) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:263) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:617) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) abr 25, 2017 1:51:16 PM org.apache.catalina.core.StandardContext startInternal GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file abr 25, 2017 1:51:16 PM org.apache.catalina.core.StandardContext startInternal GRAVE: Falló en arranque del Contexto [/inside] debido a errores previos 13:51:16,938 WARN XmlWebApplicationContext:1028 - Exception thrown from ApplicationListener handling ContextClosedEvent java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Tue Apr 25 13:51:12 CEST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:337) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1025) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 13:51:16,939 WARN XmlWebApplicationContext:1036 - Exception thrown from LifecycleProcessor on context close java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Apr 25 13:51:12 CEST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:350) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1033) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) abr 25, 2017 1:51:17 PM org.apache.catalina.startup.HostConfig deployWAR INFORMACIÓN: Deployment of web application archive /var/lib/tomcat8/webapps/inside.war has finished in 8.323 ms
But if the lines is not commented, tomcat doesnt start and catalina.out shows this:
abr 25, 2017 12:10:08 PM org.apache.jasper.servlet.TldScanner scanJars INFORMACIÓN: Al menos un JAR, que se ha explorado buscando TLDs, aún no contenía TLDs. Activar historial de depuración para este historiador para una completa lista de los JARs que fueron explorados y de los que nos se halló TLDs. Saltarse JARs no necesarios durante la exploración puede dar lugar a una mejora de tiempo significativa en el arranque y compilación de JSP . DEBUG: setDebug: JavaMail version 1.4ea
I know that is about the config, but I dont know how to proceed
Note: Never worked with .war files so Im a bit lost. Im using tomcat8.
Upvotes: 0
Views: 528
Reputation: 7950
This line
<param-value>file:${config.path}/log4j.properties</param-value>
Expects there to be a java system parameter specified, you do this in Tomcat by added to the JAVA_OPTS in catalina.sh, so you need somthing like this:
JAVA_OPTS='-Xmx256m -Djava.awt.headless=true -Dconfig.path=/var/lib/tomcat8/webapps/aplicacion/resources/config'
Extract from catalina.sh from tomcat7 is below:
# JAVA_OPTS (Optional) Java runtime options used when any command
# is executed.
# Include here and not in CATALINA_OPTS all options, that
# should be used by Tomcat and also by the stop process,
# the version command etc.
# Most options should go into CATALINA_OPTS.
#
Upvotes: 0