Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
-
Pulsar
-
Platform 209 SSO Discovery
Description
In our standard setup (13.1.0 and 13.2.0) our docker setup references the log4j config file on a non-existing location. In src/main/docker/scripts/tomcat/setenv.sh:
The following line makes a reference to the log4j file:
L4J_OPTS="-Dlog4j.configurationFile=file://${BRXM_PROJECT_PATH}/conf/log4j2-dev.xml -DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector"
Which in my opinion should be replaced with:
L4J_OPTS="-Dlog4j.configurationFile=file://${CATALINA_HOME}/conf/log4j2.xml -DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector"
Steps to reproduce:
1) Checkout 13.1.0 or 13.2.0 archetype
2) mvn clean install && mvn -Pdocker.build
3) docker run -p 8080:8080 -e profile="h2" org.example/myproject:0.1.0-SNAPSHOT
which gives error:
23-May-2019 13:16:39.936 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.5.2].
23-May-2019 13:16:39.939 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
23-May-2019 13:16:39.939 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
23-May-2019 13:16:39.949 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.0j 20 Nov 2018]
23-May-2019 13:16:40.066 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
23-May-2019 13:16:40.103 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
23-May-2019 13:16:40.106 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [776] milliseconds
23-May-2019 13:16:40.140 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
23-May-2019 13:16:40.141 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.19]
23-May-2019 13:16:40.151 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/site]
ERROR StatusLogger Unable to access file:///brxm/project/conf/log4j2-dev.xml
java.io.FileNotFoundException: /brxm/project/conf/log4j2-dev.xml (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1045)
at org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346)
at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at org.hippoecm.hst.site.container.HstContextLoaderListener.<clinit>(HstContextLoaderListener.java:53)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Also bash into the container itself to see that such file does not exist