列出Apache Tomcat中已部署的Web应用程序 [英] List deployed webapps in Apache Tomcat

查看:83
本文介绍了列出Apache Tomcat中已部署的Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取Apache Tomcat中已部署的Web应用程序的列表.另外,对于每个Web应用程序,我都需要获取已初始化的Servlet和JSP的列表.有什么想法可以做到吗?

I need to get a list of deployed webapps in Apache Tomcat. Also, for each webapp I need to get a list of initialized servlets and JSPs. Any ideas how this can be done?

我发现目录 \ tomcat \ work \ Catalina \ localhost \ 包含每个Web应用程序的子目录.那里可能不存在其他已部署的Web应用程序吗?

I've found that the directory \tomcat\work\Catalina\localhost\ contains a child directory for each webapp. Could there be any other deployed webapps that aren't present there?

推荐答案

要获取已部署的Tomcat应用程序列表,您只需配置用户/角色并使用/manager/text/list > tomcat端点

In order to get a list of deployed apps of your tomcat you just need configure user/roles and use /manager/text/list tomcat endpoint

将此添加到您的/.../.../TOMCAT_HOME/conf/tomcat-users.xml

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>

<user username="my_user" password="my_pass" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

您可以跳过"admin-gui"和如果您不执行管理员操作,则为管理员脚本"角色.

You could skip "admin-gui" & "admin-script" roles if you will not perform admin operations.

之后,重新启动tomcat

After that, restart tomcat

转到您喜欢的浏览器并输入以下网址:

Go to your favorite browser and enter this url:

http://some_ip:some_port/manager/text/list

将出现登录名.输入在您的 TOMCAT_HOME/conf/tomcat-users.xml

A login will appear. Enter the user/password configured in your TOMCAT_HOME/conf/tomcat-users.xml

只需执行以下操作即可:

Just execute this:

curl -v -u my_user:my_pass http://127.0.0.1:some_port/manager/text/list

结果应为:

OK - Listed applications for virtual host localhost
/manager:running:0:manager
/:running:0:ROOT
/docs:running:0:docs
/examples:running:0:examples
/host-manager:running:0:host-manager
/my_app:running:0:my_app
/my_other_app:running:0:my_other_app
....
* Connection #0 to host 127.0.0.1 left intact

列出带有curl的应用程序供与自动tomcat部署(Devops)相关的插件使用

List apps with curl is used by a plugins related to automated tomcat deploys (Devops)

HTH

这篇关于列出Apache Tomcat中已部署的Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆