gpt4 book ai didi

java - Maven 无法在 Mac OS X 中的 Tomcat 服务器上部署 Web 应用程序

转载 作者:行者123 更新时间:2023-11-28 23:36:36 30 4
gpt4 key购买 nike

我正在尝试使用 Maven 在 Mac OS X 系统中的 Tomcat 服务器上部署 Web 应用程序。我已经在 Linux 和 Windows 系统中完成了这项工作。但是在 Mac OS X 中我遇到了这个错误:

Uploading: http://localhost:8080/manager/text/deploy?path=%2Floja
Uploaded: http://localhost:8080/manager/text/deploy?path=%2Floja (14335 KB at 73508.0 KB/sec)

[ERROR] Tomcat return http status error: 403, Reason Phrase: Forbidden
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.646s
[INFO] Finished at: Sun Jun 08 09:19:55 GMT-03:00 2014
[INFO] Final Memory: 10M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project cms: Tomcat return http status error: 403, Reason Phrase: Forbidden:
[ERROR] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
[ERROR] <html>
[ERROR] <head>
[ERROR] <title>403 Access Denied</title>
[ERROR] <style type="text/css">
[ERROR] <!--
[ERROR] BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;font-size:12px;}
[ERROR] H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
[ERROR] PRE, TT {border: 1px dotted #525D76}
[ERROR] A {color : black;}A.name {color : black;}
[ERROR] -->
[ERROR] </style>
[ERROR] </head>
[ERROR] <body>
[ERROR] <h1>403 Access Denied</h1>
[ERROR] <p>
[ERROR] You are not authorized to view this page.
[ERROR] </p>
[ERROR] <p>
[ERROR] If you have already configured the Manager application to allow access and
[ERROR] you have used your browsers back button, used a saved book-mark or similar
[ERROR] then you may have triggered the cross-site request forgery (CSRF) protection
[ERROR] that has been enabled for the HTML interface of the Manager application. You
[ERROR] will need to reset this protection by returning to the
[ERROR] <a href="/manager/html">main Manager page</a>. Once you
[ERROR] return to this page, you will be able to continue using the Manager
[ERROR] appliction's HTML interface normally. If you continue to see this access
[ERROR] denied message, check that you have the necessary permissions to access this
[ERROR] application.
[ERROR] </p>
[ERROR] <p>
[ERROR] If you have not changed
[ERROR] any configuration files, please examine the file
[ERROR] <tt>conf/tomcat-users.xml</tt> in your installation. That
[ERROR] file must contain the credentials to let you use this webapp.
[ERROR] </p>
[ERROR] <p>
[ERROR] For example, to add the <tt>manager-gui</tt> role to a user named
[ERROR] <tt>tomcat</tt> with a password of <tt>s3cret</tt>, add the following to the
[ERROR] config file listed above.
[ERROR] </p>
[ERROR] <pre>
[ERROR] &lt;role rolename="manager-gui"/&gt;
[ERROR] &lt;user username="tomcat" password="s3cret" roles="manager-gui"/&gt;
[ERROR] </pre>
[ERROR] <p>
[ERROR] Note that for Tomcat 7 onwards, the roles required to use the manager
[ERROR] application were changed from the single <tt>manager</tt> role to the
[ERROR] following four roles. You will need to assign the role(s) required for
[ERROR] the functionality you wish to access.
[ERROR] </p>
[ERROR] <ul>
[ERROR] <li><tt>manager-gui</tt> - allows access to the HTML GUI and the status
[ERROR] pages</li>
[ERROR] <li><tt>manager-script</tt> - allows access to the text interface and the
[ERROR] status pages</li>
[ERROR] <li><tt>manager-jmx</tt> - allows access to the JMX proxy and the status
[ERROR] pages</li>
[ERROR] <li><tt>manager-status</tt> - allows access to the status pages only</li>
[ERROR] </ul>
[ERROR] <p>
[ERROR] The HTML interface is protected against CSRF but the text and JMX interfaces
[ERROR] are not. To maintain the CSRF protection:
[ERROR] </p>
[ERROR] <ul>
[ERROR] <li>Users with the <tt>manager-gui</tt> role should not be granted either
[ERROR] the <tt>manager-script</tt> or <tt>manager-jmx</tt> roles.</li>
[ERROR] <li>If the text or jmx interfaces are accessed through a browser (e.g. for
[ERROR] testing since these interfaces are intended for tools not humans) then
[ERROR] the browser must be closed afterwards to terminate the session.</li>
[ERROR] </ul>
[ERROR] <p>
[ERROR] For more information - please see the
[ERROR] <a href="/docs/manager-howto.html">Manager App HOW-TO</a>.
[ERROR] </p>
[ERROR] </body>
[ERROR]
[ERROR] </html>
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我已经在文件夹 workspace/Server/Tomcat v7.0 Server at localhost-config 中编辑了我的文件 tomcat-users.xml 以包含以下内容:

<role rolename="admin"/>
<role rolename="manager-script"/>
<user username="user001" password="123" roles="admin,manager-script"/>

在我的 pon.xml 中我也添加了这个:

<build>
<finalName>lojavirtual</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/loja</path>
<username>user001</username>
<password>123</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>

任何人都可以提供一些提示来完成这项工作吗?我想不出为什么这在 Linux/Windows 中有效而在 MacOSX 中无效。

最佳答案

我遇到了同样的问题。我将 2.2 更改为 2.0 并为我工作。

关于java - Maven 无法在 Mac OS X 中的 Tomcat 服务器上部署 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24106134/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com