有没有办法获取tomcat中上下文根的绝对路径?
我有一个问题,经过大量阅读和研究,tomcat 似乎正在运行它自己的另一个实例,从而提供我更新的应用程序的旧版本(或者以某种方式在某个地方缓存了我的 web 应用程序的旧版本,仅提供该服务。) 我在 Windows 计算机上的 eclipse 中处理该应用程序,并将其作为 ROOT 应用程序部署在 Linux 服务器上(将 war 文件重命名为 ROOT.war)。 我想知道的是,是否有一种方法可以通过让 tomcat 记录为旧版本应用程序提供服务的 servlet 的上下文根的输出来定位 tomcat 所服务的旧版本。 按照目前的情况,更新的应用程序创建的任何文件都会在正确的目录中创建,但由于应用程序实例不同,因此无法在创建后不久访问这些文件。 欢迎任何帮助/提示
I have a problem that, after a lot of reading and research, seems like tomcat is running another instance of itself and thus serving an old version of my updated app (or somehow has cached an older version of my webapp somewhere only serves that.)
I work on the app in eclipse on a windows machine and deploy it on a Linux server as a ROOT app (Renaming the war file to a ROOT.war).
What I'd like to know is if there's a way to locate the older version that tomcat is serving by getting tomcat to log an output of the context root of the servlet that's serving the older version of the app.
As it stands it the moment any files created by the updated app get created in the right directory but because the app instances are different it can't access the files shortly after they're created.
Any help/hints would be welcomed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要回答标题中的问题,让您的代码基本上执行以下操作:
要解决问题中描述的问题,关闭 Tomcat 并删除其
/work
目录中的所有内容,删除中展开的 WAR >/webapps
并删除/conf
目录中的/Catalina
子目录(如果有),然后重新启动。To answer the question in the title, let your code basically do the following:
To solve the problem described in the question, shutdown Tomcat and delete everything in its
/work
directory, delete the expanded WAR in/webapps
and remove the/Catalina
subdirectory of/conf
directory (if any) and then restart.