eclipse 显示 Tomcat 管理器应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6776421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Display the Tomcat Manager Application?
提问by Chucky
using this tutorial http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php#install_viewer
使用本教程http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php#install_viewer
And it tells me to display the Tomcat manager application through this link http://localhost:8080/manager/html.
它告诉我通过这个链接http://localhost:8080/manager/html显示 Tomcat 管理器应用程序。
However when I click it I get an error from my browser saying it could not connect. Why is this? How exactly does one display the Tomcat Manager Application
但是,当我单击它时,我的浏览器出现错误,说它无法连接。为什么是这样?Tomcat Manager 应用程序究竟是如何显示的
采纳答案by gamerson
If you are launching tomcat from within Eclipse (using the webtools tomcat server adapter) you will have to make sure you have changed the settings to use the installation directory to launch instead of the default which uses a separate location for loading and deploying webapps. So just having the manager in your webapps in the tomcat installation wont be enough to see the manager since by default tomcat launched by Eclipse doesn't look for apps in the webapps folder.
如果您从 Eclipse 中启动 tomcat(使用 webtools tomcat 服务器适配器),您必须确保已更改设置以使用安装目录来启动,而不是默认使用单独的位置来加载和部署 web 应用程序。因此,仅在 tomcat 安装中的 webapps 中拥有管理器不足以看到管理器,因为默认情况下 Eclipse 启动的 tomcat 不会在 webapps 文件夹中查找应用程序。
Just make sure that catalina.base and catalina.home point to the tomcat installation directory
只要确保 catalina.base 和 catalina.home 指向 tomcat 安装目录
回答by Emanuele Bellini
I solved that problem by setting up the server management in Eclipse to take control of the Tomcat installation, which has the manager enabled. This thread explains how to do it:
我通过在 Eclipse 中设置服务器管理来控制启用了管理器的 Tomcat 安装来解决该问题。这个线程解释了如何做到这一点:
Tomcat started in Eclipse but unable to connect to http://localhost:8085/
Tomcat 在 Eclipse 中启动但无法连接到 http://localhost:8085/
Anyway I have the console at the address you mentioned:
无论如何,我在你提到的地址有控制台:
localhost:8080/manager/html
本地主机:8080/经理/html
in Tomcat 7.
在 Tomcat 7 中。
回答by Hardik Doshi
Below things worked for me on fresh installation of apache-tomcat-7.0.63 -
Please make changes to below files and restart the server using %CATALINA_HOME%\bin>catalina.bat start and then try -
http://localhost:8080/manager/html
1) configured variables - CATALINA_HOME and CATALINA_BASE
2) created manager.xml file inside %CATALINA_HOME%\conf\Catalina\localhost
please paste below lines into manager.xml file -
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.0\.0\.1" />
</Context>
3) modified %CATALINA_HOME%\conf\tomcat-users.xml file
please paste below lines into tomcat-users.xml file
<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="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
4) modified %CATALINA_HOME%\conf\server.xml
Search this line '<Engine name="Catalina" defaultHost="localhost">' and add below line after that -
<Realm className="org.apache.catalina.realm.MemoryRealm" />
回答by Vineet Sharma
- Right Click On Apache Tomcat
- Select Open
- Go to Server Locations Tab
- Select use tomcat installation
- Goto the installation directory
- Edit apache-tomcat-8.0/conf/tomcat-users.xml
Add the below users in the xml file
<role rolename="tomcat"/> <role rolename="manager-gui"/> <role rolename="manager"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager"/>
Copy tomcat-user.xml file in eclipse workspace server's tomcat directory
- Now open tomcat manager page http://localhost:/manager/html/
- Use username and password tomcat and manager page will open on your browser
- 右键单击 Apache Tomcat
- 选择打开
- 转到服务器位置选项卡
- 选择使用tomcat安装
- 进入安装目录
- 编辑 apache-tomcat-8.0/conf/tomcat-users.xml
在xml文件中添加以下用户
<role rolename="tomcat"/> <role rolename="manager-gui"/> <role rolename="manager"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager"/>
复制 eclipse 工作空间服务器的 tomcat 目录下的 tomcat-user.xml 文件
- 现在打开 tomcat 管理器页面http://localhost:/manager/html/
- 使用用户名和密码 tomcat 和管理器页面将在您的浏览器上打开
回答by achieven
Hey this issue just took me a lot of time to fix, so my tips would be (if it's relevant to others that view this page as well):
嘿,这个问题花了我很多时间来解决,所以我的提示是(如果它也与查看此页面的其他人相关):
Use command line commands (set CATALINA_HOME etc..) instead of changing it through control panel enviroment variables.
When people use %.....% it means give the path to the folder of this variable, except the folder which you are at in command promplt. For example if you are in C:\ in command line and someone tells you to do %CATALINA_HOME%\bin, assuming for example the path for CATALINA_HOME is C:\Program Files, it means write in command line: Pragram Files\bin (excluding C:).
使用命令行命令(设置 CATALINA_HOME 等)而不是通过控制面板环境变量更改它。
当人们使用 %.....% 时,它意味着给出此变量文件夹的路径,除了您在命令提示符中所在的文件夹。例如,如果您在命令行中的 C:\ 中,有人告诉您执行 %CATALINA_HOME%\bin,例如假设 CATALINA_HOME 的路径为 C:\Program Files,则表示在命令行中写入:Pragram Files\bin (不包括 C:)。
Could have saved me a lot of time.
可以为我节省很多时间。
回答by Daniel
Make sure you activated the manager app and created a user that has access to it. For details see the documentation to your Tomcat-Version (e.g. for Tomcat 7: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html)
确保您激活了管理器应用程序并创建了一个有权访问它的用户。有关详细信息,请参阅 Tomcat 版本的文档(例如,对于 Tomcat 7:http: //tomcat.apache.org/tomcat-7.0-doc/manager-howto.html)
回答by watery
If you want to keep using the workspace metadata for you Eclipse Tomcat instance, here's how you can get the manager webapp to work.
如果您想继续为您的 Eclipse Tomcat 实例使用工作区元数据,您可以通过以下方法使管理器 Web 应用程序正常工作。
The base configuration instructions can be found in Apache Tomcat 7 Manager App HOW-TO.
基本配置说明可以在Apache Tomcat 7 Manager App HOW-TO 中找到。
In your ServersIDE project, the <server name>-config\server.xml
file should have the following nested entries:
在您的服务器IDE 项目中,该<server name>-config\server.xml
文件应具有以下嵌套条目:
...
<Service name="Catalina">
...
<Engine defaultHost="localhost" name="Catalina">
...
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
...
Open your Eclipse workspace metadata, where the Tomcat instance folders are published, i.e.:
打开 Eclipse 工作区元数据,其中发布了 Tomcat 实例文件夹,即:
<your-workspace-dir>\.metadata\.plugins\org.eclipse.wst.server.core\tmp<n>
there, inside the conf\
folder create a new folder named Catalina
(derived from <Engine ... name="Catalina">
above), inside this folder create another one named localhost
(derived from <Host ... name="localhost" ...>
above) and in this last one edit a file named manager.xml
with the content as per the linked docs:
在那里,在conf\
文件夹内创建一个名为Catalina
(从<Engine ... name="Catalina">
上面派生)的新文件夹,在该文件夹内创建另一个名为localhost
(从<Host ... name="localhost" ...>
上面派生)的文件夹,在最后一个文件夹中manager.xml
,根据链接的文档编辑一个以内容命名的文件:
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.0\.0\.1" />
</Context>
Now publish and start the server instance, the manager will be deployed along side the other webapps you have added — for me it is the last one being deployed.
现在发布并启动服务器实例,管理器将与您添加的其他 web 应用程序一起部署——对我来说,这是最后一个部署的。
Tested with Tomcat 7, but I guess it would work for any Tomcat version that supports that linked configuration.
使用 Tomcat 7 进行了测试,但我想它适用于支持该链接配置的任何 Tomcat 版本。
Side note
边注
Do not create the above mentioned folders and files inside the configuration stored in the Eclipse Serversproject, they won't be published in the org.eclipse.wst.server.core\tmp<n>\conf
directory.
不要在 Eclipse Servers项目中存储的配置中创建上述文件夹和文件,它们不会发布在org.eclipse.wst.server.core\tmp<n>\conf
目录中。