简体   繁体   English

Maven不会部署到tomcat; 给出'405'错误

[英]Maven won't deploy to tomcat; gives '405' error

I'm trying to deploy a simple JSF app onto a Tomcat 8 server on my local machine. 我正在尝试将一个简单的JSF应用程序部署到我本地计算机上的Tomcat 8服务器上。 When I run mvn tomcat:deploy, I get the following feedback: 当我运行mvn tomcat:deploy时,我得到以下反馈:

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>

Apparently Maven is finding the server, but is unable to deploy onto it. 显然Maven正在寻找服务器,但无法部署到它上面。 I looked around the interwebs and found that this could be due to maven trying to use a "PUT" command. 我环顾了这些互联网,发现这可能是因为maven试图使用“PUT”命令。 However, after looking at the following answer , I added this code to my tomcat web.xml in the default servlet: 但是,在查看以下答案后 ,我将此代码添加到默认servlet中的tomcat web.xml:

<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? 对于我能做些什么来完成这项工作,你有什么进一步的建议吗?

I'm using Maven 3.1.1 and Tomcat 8.0.1. 我正在使用Maven 3.1.1和Tomcat 8.0.1。

It turns out that this was a silly mistake- the user that I had maven using had "manager-gui" privileges instead of "manager-script." 事实证明这是一个愚蠢的错误 - 我使用maven的用户具有“manager-gui”权限而不是“manager-script”。 Resolving this issue fixed my problem. 解决这个问题解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM