3
votes

Tomcat logs:

java.io.IOException: Unable to create the file [/usr/local/tomcat/webapps/mywebapp/META-INF/war-tracker]
    at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:180)
    at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:609)
    at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:742)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:301)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:182)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:972)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

Suddenly the server does not work, Not extracted The WAR file in webapps, can not work with API requests,

Context file :

<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

I tried to deploye from the manager on TOMCAT's page and again it was not successful.

find in logs : Unable to create the file [/usr/local/tomcat/webapps/mywebapp/META-INF/war-tracker] I looked for solutions and did not find, anyone there that happened to him?

Tomcat : apache-tomcat-9.0.13 openjdk version "1.8.0_171"

2
I feel like there is more to the exception. Perhaps a permission denied error? Can you look further down in the log to see if there is more information? - stdunbar
Hi @stdunbarthere is no more details of the error. - Lior A
I deleted the tomcat and install another, even less versions, and the same error. - Lior A
@stdunbar i change the war file permissions like : chmod -R 777 mywebapp.war and nothing the tomcat not extract the war file. and in the log thats the error. - Lior A
Without additional information it's just a guess then. The permissions on your webapp are not important - it's the permissions on, I believe, the META-INF directory. Are you short on disk space? Again, I'm afraid I'm guessing with the information available. - stdunbar

2 Answers

14
votes

The problem is the file "META-INF/war-tracker" in the deployment-war:

From the Tomcat-docs:

Note: If Tomcat expands the WAR file then it will add a file (/META-INF/war-tracking) to the unpacked directory structure which it uses to detect changes in the WAR file while Tomcat is not running. Any such change will trigger the deletion of the expanded directory and the deployment of the updated WAR file when Tomcat next starts.

It seems that you manually packed the war-file and included META-INF/war-tracker. During deployment, Tomcat (from version 8 onwards AFAIK) tries to create said file to detect the changes. However, if such a file exists, Tomcat is not able to create the file and will throw the exception you mentioned above.

Solution:

Remove the file "META-INF/war-tracker" from your war-file before deployment and you're all set.

5
votes

We had exactly the same behaviour under Windows. In our case, the explanation was simple, whereas hard do find: there already was a file META-INF/war-tracker within the *.war we were deploying. Presumably, the war had been forged by hand based on an already unpacked directory tree instead of being created by the IDE.