本文介绍了将战争部署到 tomcat7/webapps 的蚂蚁目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 ant 目标将刚刚创建的 *.war(已分解)部署到 ${TOMCAT_HOME}/webapps.>

配置

我的 tomcat 版本是 7.0.37,tomcat-users.xml 是:

 <role rolename="role1"/><role rolename="manager-gui"/><user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/><user username="both" password="tomcat" roles="tomcat,role1,manager-gui"/><user username="role1" password="tomcat" roles="role1"/>

war.properties 是:

# War Build 属性package.dir=${basedir}/packagewar.exploded.dir=${deploy.dir}/war-ex# --------- Tomcat 设置 ---------------# 修正:tomcat.url=http://localhost:8080/manager/texttomcat.url=http://localhost:8080/managertomcat.username=tomcattomcat.password=tomcat上下文路径=/eccount

我的deploy-war目标如下(tomcat-deploy.xml):

<target name="deploy-war" depends="build-wardir" description="安装网络应用程序"><catalina-deploy url="${tomcat.url}"用户名="${tomcat.username}"密码="${tomcat.password}"路径="${上下文路径}"localwar="file://${war.exploded.dir}"/></目标>

问题

当我通过命令行点击 ant deploy-war 时,出现以下异常:

FileNotFoundException : http://localhost:8080/manager/deploy?path=%2Feccount&war=file%3A%2F%2FC%3A%5Ceccount%2Fdeploy%2Fwar-ex

但是,相同的路径 file:///C:/eccount/deploy/war-ex 可以通过网络浏览器访问.

参考文献

在 Tomcat 7.0.37 中远程部署新应用程序

在Tomcat上部署war文件

Apache Ant 如何将 .war 文件部署到 Tomcat

用于 Tomcat 7 的 Catalina-Ant

解决方案

好吧,问题已解决:

第 1 步:更新 AT7 的 tomcat 管理器 url

 tomcat.url=http://localhost:8080/manager/text

第 2 步:为用户添加额外角色

 <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-script"/>

感谢 Ant Tomcat 7 重新加载 FileNotFoundException

I want to deploy the just created *.war (exploded) to ${TOMCAT_HOME}/webapps using ant target.

CONFIGURATION

My tomcat version is 7.0.37 and tomcat-users.xml is :

  <role rolename="tomcat"/>
  <role rolename="role1"/>
   <role rolename="manager-gui"/>

  <user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
  <user username="both" password="tomcat" roles="tomcat,role1,manager-gui"/>
  <user username="role1" password="tomcat" roles="role1"/>

war.properties is :

# War Build Properties

package.dir=${basedir}/package
war.exploded.dir=${deploy.dir}/war-ex
# --------- Tomcat Settings ---------------

# FIXME : tomcat.url=http://localhost:8080/manager/text
tomcat.url=http://localhost:8080/manager

tomcat.username=tomcat
tomcat.password=tomcat

context-path=/eccount

My deploy-war target is as follows (tomcat-deploy.xml):

<taskdef name="catalina-deploy"    classname="org.apache.catalina.ant.DeployTask"       classpathref="catalina.lib.classpath"/>
  <target name="deploy-war" depends="build-wardir" description="Install web app">
    <catalina-deploy url="${tomcat.url}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="${context-path}"
            localwar="file://${war.exploded.dir}"/>
  </target>

PROBLEM

When I hit ant deploy-war via command line , I get the following exception :

FileNotFoundException : http://localhost:8080/manager/deploy?path=%2Feccount&war=file%3A%2F%2FC%3A%5Ceccount%2Fdeploy%2Fwar-ex

But, the same path file:///C:/eccount/deploy/war-ex is accesible via web browser.

REFERENCES

Deploy A New Application Remotely in Tomcat 7.0.37

Deployment of war file on Tomcat

How Apache Ant deploys .war file to Tomcat

Catalina-Ant for Tomcat 7

解决方案

Well, the issue is fixed :

STEP 1 : update tomcat manager url for AT7

 tomcat.url=http://localhost:8080/manager/text

STEP 2 : add extra role to user

  <role rolename="manager-script"/>

  <user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-script"/>

Thanks to Ant Tomcat 7 Reload FileNotFoundException

这篇关于将战争部署到 tomcat7/webapps 的蚂蚁目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 08:36