3

Getting symlink error after migrating to tomcat server 8.5.65 On tomcat startup (running spring mvc project) getting symlink error as below:

SEVERE : org.apache.catalina.webresources.AbstractFileResourceSet.file Resource for web application [/] at path [/] was not loaded as the canonical path [/] did not match. Use of symlinks is one possible cause.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Monish
  • 31
  • 2
  • I'm seeing this in 8.5.64 as well – Andrew Schlei Apr 20 '21 at 18:22
  • Is the text in your brackets ("[/]") the actual text in the error or did you change it for posting? I ask because in my warning the text for the path is different from the text for the canonical path (the canonical path has question marks for UTF-8 characters). – theyuv Jun 01 '22 at 06:56

1 Answers1

1

We found that in our case, this error was appearing because the default character set in our OS was not set to UTF-8. To resolve, we added the following lines to the TOMCAT_HOME/bin/setenv.sh script:

export LC_ALL="en_US.utf-8"
export LANG="$LC_ALL"
Templar
  • 5,067
  • 7
  • 34
  • 39
  • Can you explain this a bit. Why does changing the OS character set fix this issue? All of the other answers (eg: https://stackoverflow.com/a/138950/3684479 or https://balusc.omnifaces.org/2009/05/unicode-how-to-get-characters-right.html) which explain how to make sure your setup can handle utf-8 characters do not include this... However, it does fix the issue. – theyuv Jun 01 '22 at 08:22
  • What we found is that the `AbstractFileResourceSet#file` method compares canonical and absolute file paths and in the case of discrepancies, the message above is printed. When debugging, we found that if the character set is not set to UTF-8, the canonical path is incorrectly resolved. – Templar Jun 29 '22 at 00:51