Maven 不会部署到 tomcat;给出“405"错误 [英] Maven won't deploy to tomcat; gives '405' error

查看:59
本文介绍了Maven 不会部署到 tomcat;给出“405"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个简单的 JSF 应用程序部署到本地机器上的 Tomcat 8 服务器上.当我运行 mvn tomcat:deploy 时,我得到以下反馈:

I'm trying to deploy a simple JSF app onto a Tomcat 8 server on my local machine. When I run mvn tomcat:deploy, I get the following feedback:

C:\_workspace\portfolio>mvn tomcat:deploy
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.italic:portfolio:war:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:tomcat-maven-plugin is missing. @ line 38, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Portfolio 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) @ portfolio >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ portfolio ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ portfolio ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ portfolio ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ portfolio ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ portfolio ---
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ portfolio ---
[INFO] Packaging webapp
[INFO] Assembling webapp [portfolio] in [C:\_workspace\portfolio\target\portfolio-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\_workspace\portfolio\src\main\webapp]
[INFO] Webapp assembled in [184 msecs]
[INFO] Building war: C:\_workspace\portfolio\target\portfolio-0.0.1-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ portfolio <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ portfolio ---
[INFO] Deploying war to http://localhost:8080/portfolio
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.499s
[INFO] Finished at: Sat Feb 08 19:10:27 PST 2014
[INFO] Final Memory: 21M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project portfolio: Cannot invoke Tomcat manager: Server returne
d HTTP response code: 405 for URL: http://localhost:8080/manager/text/deploy?path=%2Fportfolio&war= -> [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
C:\_workspace\portfolio>

显然 Maven 正在查找服务器,但无法部署到服务器上.我环顾了互联网,发现这可能是由于 maven 尝试使用PUT"命令.但是,在查看以下 answer 后,我将此代码添加到默认 servlet 中的 tomcat web.xml 中:

Apparently Maven is finding the server, but is unable to deploy onto it. I looked around the interwebs and found that this could be due to maven trying to use a "PUT" command. However, after looking at the following answer, I added this code to my tomcat web.xml in the default servlet:

<init-param>
    <param-name>readonly</param-name>
    <param-value>false</param-value>
</init-param>

然而,它似乎没有任何影响.您对我可以做些什么来使这项工作有任何进一步的建议吗?

However, it doesn't appear to have had any effect. Do you have any further advice on what I can do to get this working?

我使用的是 Maven 3.1.1 和 Tomcat 8.0.1.

I'm using Maven 3.1.1 and Tomcat 8.0.1.

推荐答案

事实证明这是一个愚蠢的错误 - 我使用 maven 的用户拥有manager-gui"权限而不是manager-script".解决此问题解决了我的问题.

It turns out that this was a silly mistake- the user that I had maven using had "manager-gui" privileges instead of "manager-script." Resolving this issue fixed my problem.

这篇关于Maven 不会部署到 tomcat;给出“405"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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