Eclipse WebApp在Tomcat上通过Maven进行部署会导致错误:“无法在上下文路径中部署应用程序”

如何解决Eclipse WebApp在Tomcat上通过Maven进行部署会导致错误:“无法在上下文路径中部署应用程序”

| 当我尝试使用命令“ 0”将IBM Developerworks中描述的HelloWorld项目部署到带有Maven 3的Tomcat 7时,出现错误ѭ1。 在列出的应用程序中,我的/ server出现了,但无法启动。 我根据base22的教程修改了我的maven Web项目,并在pom.xml中将Tomcat 2部署的修订“ 2”应用为locitic的descibet。 命令:
mvn tomcat:deploy
错误:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project server: Cannot
invoke Tomcat manager: FAIL - Failed to deploy application at context path /server -> [Help 1]
Tomcat的tomcat-users.xml
<tomcat-users>
  <role rolename=\"admin-gui\"/>
  <role rolename=\"manager-gui\"/>
  <role rolename=\"manager\"/>
  <role rolename=\"admin\"/>
  <user username=\"admin\" password=\"admin\" roles=\"admin,manager,admin-gui,manager-gui\"/>
</tomcat-users>
项目web.xml
<servlet>
  <servlet-name>Jersey REST Service</servlet-name>
<servlet-class>
  com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
  <init-param>
    <param-name>com.sun.jersey.config.property.packages</param-name>
    <param-value>sample.hello.resources</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>Jersey REST Service</servlet-name>
  <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
-e错误:
PS C:\\Users\\Dom\\work\\server> mvn tomcat:deploy -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.elexess:server:war:0.0.1-SNAPSHOT
[WARNING] \'build.plugins.plugin.version\' for org.codehaus.mojo:tomcat-maven-plugin is missing. @ line 58,column 18
[WARNING] \'repositories.repository.layout\' for maven-repository.java.net uses the unsupported value \'legacy\',artifact r
esolution might fail. @ line 52,column 14
[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 server Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) @ server >>>
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ server ---
[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:2.3.2:compile (default-compile) @ server ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ server ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\\Users\\Dom\\work\\server\\src\\test\\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ server ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ server ---
[INFO] Surefire report directory: C:\\Users\\Dom\\work\\server\\target\\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0,Failures: 0,Errors: 0,Skipped: 0

[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ server ---
[INFO] Packaging webapp
[INFO] Assembling webapp [server] in [C:\\Users\\Dom\\work\\server\\target\\server]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\\Users\\Dom\\work\\server\\src\\main\\webapp]
[INFO] Webapp assembled in [85 msecs]
[INFO] Building war: C:\\Users\\Dom\\work\\server\\target\\server.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task,or ignoreWebxml attribute is specified as \'true\')
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ server <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ server ---
[INFO] Deploying war to http://localhost:8080/server
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.017s
[INFO] Finished at: Tue Jun 14 08:00:14 CEST 2011
[INFO] Final Memory: 8M/164M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project server: Cannot
invoke Tomcat manager: FAIL - Failed to deploy application at context path /server -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1
:deploy (default-cli) on project server: Cannot invoke Tomcat manager: FAIL - Failed to deploy application at context pa
th /server

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager: FAIL - Failed to deploy applica
tion at context path /server

        at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:145)
        at org.codehaus.mojo.tomcat.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:70)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
[ERROR]
[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
项目pom.xml
<build>
        <finalName>server</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <configuration>
                         <url>http://localhost:8080/manager/html</url>
                         <server>mytomcat</server>
                         <path>/${project.build.finalName}</path>
                </configuration>
            </plugin>
        </plugins>
    </build>
Maven settings.xml
<server>
        <id>mytomcat</id>
        <username>admin</username>
        <password>admin</password>
</server>
    

解决方法

        对于Tomcat 7,您需要使用\“ text \” URL进行部署。该URL是脚本部署所使用的URL。 您正在尝试使用\“ gui \” URL进行部署。 设置方法如下: tomcat-users.xml
<role rolename=\"manager-script\"/>
<user password=\"script\" roles=\"manager-script\" username=\"script\"/>
然后,在pom.xml中,将URL设置为:\“ http:// localhost:8080 / manager / text / \” 另外,在您的maven settings.xml中,将您的用户名/密码设置为脚本/脚本。     ,        我收到这个错误,
  Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project projectname: 
Cannot invoke Tomcat manager: FAIL - Application already exists at path /path
然后我将配置从
mvn tomcat:deploy
替换为
mvn tomcat:redeploy
    ,        tomcat maven插件使用情况页面显示   缺省的Tomcat管理器URL是http:// localhost:8080 / manager。 我认为您必须从配置中删除“ 14”部分。     ,        该应用程序已经存在于该位置,您需要先取消部署。 您可以先使用tomcat管理器取消部署,也可以使用maven取消部署
mvn tomcat:undeploy
或使用以下命令:
mvn package tomcat:redeploy
覆盖当前实例。 欲了解更多信息,请点击这里     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-