<p>I have built a docker image based on tomcat base image and copying the MyExample.war file to tomcat/webapp folder in my custom dockerFile and built an image.
It successfully deploys the war file and is able to run on my system with docker.</p>
<p>But when i deploy the same image in kubernetes server. It deploys the application successfully.
And the pod becomes up. But i see an error in the log as below.</p>
<pre><code>{&quot;type&quot;:&quot;log&quot;, &quot;level&quot;:&quot;ERROR&quot;, &quot;time&quot;:&quot;2022-03-03T12:18:38.081Z&quot;, &quot;message&quot;:&quot;Exception fixing docBase for context [/MyExample]&quot;}
</code></pre>
<p>And there is no stack trace available i enabled debug logs and checked.
what is the cause of this error is unknown since i don't have any stacktrace.</p>
<p>Below is the full stackTrace when this error is printed.</p>
<pre><code>{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;IntrospectionUtils:org.apache.catalina.core.StandardContext.addWatchedResource( WEB-INF/tomcat-web.xml)&quot;}}
{&quot;type&quot;:&quot;log&quot;,&quot;level&quot;:&quot;DEBUG&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;characters(\n    )&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;startElement(,,WatchedResource)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  New match='Context/WatchedResource'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire begin() for CallMethodRule[methodName=addWatchedResource, paramCount=0, paramTypes={java.lang.String}]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;characters(${catalina.base}/conf/web.xml)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;endElement(,,WatchedResource)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  match='Context/WatchedResource'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  bodyText='${catalina.base}/conf/web.xml'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire body() for CallMethodRule[methodName=addWatchedResource, paramCount=0, paramTypes={java.lang.String}]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire end() for CallMethodRule[methodName=addWatchedResource, paramCount=0, paramTypes={java.lang.String}]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;[CallMethodRule]{Context/WatchedResource} Call org.apache.catalina.core.StandardContext.addWatchedResource(/opt/tomcat/conf/web.xml/java.lang.String)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;IntrospectionUtils:org.apache.catalina.core.StandardContext.addWatchedResource( /opt/tomcat/conf/web.xml)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.078Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;characters(\n\n    )&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;characters(\n    )&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;characters(\n)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;endElement(,,Context)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  match='Context'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  bodyText='\n\n    \n    \n    \n    \n    \n\n    \n    \n'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire body() for SetPropertiesRule[]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire end() for SetPropertiesRule[]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;endDocument():  2 elements left&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Successfully processed context [/MyExample] configuration file [file:/opt/tomcat/conf/context.xml]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.079Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Setting state for [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MyExample]] to [STARTING_PREP]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;ERROR&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.081Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Exception fixing docBase for context [/MyExample]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.081Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Starting MyExample&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.087Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Configuring default Resources&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.091Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Setting state for [org.apache.catalina.webresources.StandardRoot@6b587673] to [INITIALIZING]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.091Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Managed= Catalina:type=WebResourceRoot,host=localhost,context=/MyExample&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.091Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Looking for descriptor &quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.092Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;Found jar:file:/opt/tomcat/lib/catalina.jar!/org/apache/catalina/webresources/mbeans-descriptors.xml&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.092Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;setDocumentLocator(com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy@1bbae752)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.092Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;startDocument()&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.092Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;resolveEntity('-//Apache Software Foundation//DTD Model MBeans Configuration File', 'http://jakarta.apache.org/commons/dtds/mbeans-descriptors.dtd', 'null')&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.093Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot; Resolving to alternate DTD 'jar:file:/opt/tomcat/lib/tomcat-coyote.jar!/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;startElement(,,mbeans-descriptors)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  New match='mbeans-descriptors'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;No rules found matching [mbeans-descriptors]&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;ignorableWhitespace(\n\n  )&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;startElement(,,mbean)&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  New match='mbeans-descriptors/mbean'&quot;}}
{&quot;type&quot;:&quot;log&quot;,  &quot;level&quot;:&quot;DEBUG&quot;, &quot;neid&quot;:&quot;0&quot;,  &quot;time&quot;:&quot;2022-03-03T12:18:38.094Z&quot;, &quot;log&quot;:{&quot;message&quot;:&quot;  Fire begin() for ObjectCreateRule[className=org.apache.tomcat.util.modeler.ManagedBean, attributeName=null]&quot;}}
</code></pre>
<p>This error is not seen when i run it in local docker on my system, where as only on kubernetes cluster when i deploy it i see this error.  But Application is deployed successfully after the error and i'm able to access the services. Also the time taken for tomcat to initialize and deploy the application is more than 5 minutes. Where as in local docker it is in seconds.
DOn't know if this error is causing this delay. Any help will be appreciated.</p>

Lucia
<p>It was due to permission issues in the kubernetes pod. I copied the war file into tomcat/webapps directory with the root user and then i had switched to tomcat user in the dockerFile. Which somehow used to work in local docker in my system, but failed in kubernetes pod.</p>
