本文介绍了使用Ant在Tomcat中部署Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我创建了一个Web应用程序。我正在使用ant来构建战争并在tomcat中部署。


war文件部署在TOMCATE_HOME / work / standalone / localhost / onlineres.war下。


我的源文件位于D:\ Sadiq \Projects \Onlineres中。文件夹结构如下。


1)D:\Sadiq\Projects \Onlineres:

这个文件夹有context.xml, web.xml,build.xml和build.properties文件。


2)D:\Sadiq\Projects\Onlineres\src:

这个文件夹有java文件


3)D:\Sadiq \Projects \ Onlineres \web:

这个文件夹有jsp页面,css和java脚本。


在build.xml文件中执行构建目标后,D:\ Sadiq \Projects \Onlineres中包含以下文件夹。


1)D:\Sadiq \Projects \Onlineres\war \ onlineline

这个文件夹有jsp页面,css和java脚本等等


2)D:\Sadiq \Projects \Onlineres\war \ onlineline \ WEBB-INF

这个文件夹有web.xml和所有类文件。


3)D:\Sadiq \Projects \Onlineres\war \ onlineline \ MET-INF

这个文件夹有context.xml文件


我已将D:\Sadiq\Projects \Onlineres\war \ onlineline文件夹复制到TOMCATE_HOME \webapps中。


现在重启后服务器,我尝试通过URLhttp:// localhost:8888 / onlineres / index.jsp访问应用程序。现在我找不到页面错误。 (注意:我在安装tomcat时已将端口配置为8888)


但我使用ant部署应用程序,我可以通过上述URL访问应用程序


我也试过使用安装目标。在这种情况下,onlineres.war文件在D:\Sadiq \Projects \Onlineres \\\\\\\\\\\\\\\\\\\\在这种情况下,war文件不会复制到TOMCATE_HOME / work / standalone / localhost / onlineres.war。而是应用程序从路径D:\Sadiq \Projects \ Onlineres \ war \ onlineline.war运行。但是一旦我重新启动应用程序,我无法访问该应用程序。


我想要做的是如下。


我会喜欢在不创建文件onlineres.war的情况下运行应用程序。我有文件夹D:\Sadiq \Projects \ Onlineres \ war \ onlineline使用ant执行build.xml中的构建目标之后。我想从这个文件夹运行应用程序。


这是否可行?如果是这样我必须改变什么?请帮忙。


提前致谢。

M. Jahabar Sadiq。

Hi

I have created a web application. I am using ant to build the war and deploy in tomcat.

The war file is deployed under "TOMCATE_HOME/work/standalone/localhost/onlineres.war".

I have my source files in "D:\Sadiq\Projects\Onlineres". The folder structure is as follows.

1) D:\Sadiq\Projects\Onlineres:
This folder is having the context.xml, web.xml, build.xml and build.properties files.

2) D:\Sadiq\Projects\Onlineres\src:
This folder is having the java files

3) D:\Sadiq\Projects\Onlineres\web:
This folder is having the jsp pages, css and java scripts.

After executing the build target in build.xml file, the following folders have been included in D:\Sadiq\Projects\Onlineres.

1) D:\Sadiq\Projects\Onlineres\war\onlineres
This folder is having the jsp pages, css and java scripts etc.

2) D:\Sadiq\Projects\Onlineres\war\onlineres\WEB-INF
This folder is having web.xml and all class files.

3) D:\Sadiq\Projects\Onlineres\war\onlineres\META-INF
This folder is having the context.xml file

I have copied the D:\Sadiq\Projects\Onlineres\war\onlineres folder into "TOMCATE_HOME\webapps".

Now after restarting the server, I try to access the application by the URL "http://localhost:8888/onlineres/index.jsp". Now I got the page not found error. (Note: I have configured the port as 8888 while installing the tomcat)

But I deploy the application using ant, I am able to access the application by the above said URL

Also I have tried using the install target. In this case the "onlineres.war" file is created within the D:\Sadiq\Projects\Onlineres\war\onlineres. In this case the war file is not copied to "TOMCATE_HOME/work/standalone/localhost/onlineres.war". Instead the application is running from the path "D:\Sadiq\Projects\Onlineres\war\onlineres.war ". But once I restarted the application the I am unable to access the application.

What I want to do is as follows.

I would like to run the application without creating the file "onlineres.war". I have the folder "D:\Sadiq\Projects\Onlineres\war\onlineres" after the build target in build.xml is executed using ant. I would like to run the application from this folder.

Whether this is possible? If so what I have to change? Please help.

Thanks in advance.
M. Jahabar Sadiq.

推荐答案


展开 | 选择 | Wrap | 行号



这篇关于使用Ant在Tomcat中部署Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 20:34