简体   繁体   中英

Tomcat 8.5/9 context reload on web app symlink change

I have tomcat 8.5.72 where all applications are symlinks in the webapps

/usr/local/tomcat/webapps/app1 -> /data/app1.0.0.1

Everything works correctly on startup. I have autoDeploy and allowLinking configured.

Now I want to change symlink to point to /data/app1.0.0.2 and remove original /data/app1.0.0.1

And here i get an error SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.reload Exception starting Context with name [/app1]

Caused by: java.lang.IllegalArgumentException: The main resource set specified [/data/app1.0.0.1] is not valid

Was working good in tomcat 8.0.x. On 8.5.x I need to restart tomcat. I guess on 9 too

Maybe some security considerations lead to the change... but is there a way to restore old one? aka "re-read/re-resolve" symlinks?

Apparently it works fine if link is deleted and created. Issue happens if link target is changed with "ln -snf" - my case, where deployments are managed by puppet.

All the links now are resolved with getCanonicalPath or getAbsolutePath. So change it detected, but still for the old docBase points to old absolute dir.

I've ended up recompiling with patch in fixDocBase method in ContextConfig using getPath instead of getAbsolutePath/getCanonicalPath for directory based deployments

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM