使用Ant在Tomcat中部署Web应用程序 [英] Deploying web application in Tomcat using Ant

查看:77
本文介绍了使用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.

推荐答案

嘿那里!


我感觉到你的痛苦;因为我遇到过与Tomcat类似的问题......但是在部署之后,你将不再需要localhost。我相信您需要您的生产应用程序服务器名称。


我会尝试不打包成war文件并使用您的计算机名称,作为测试,看看您的Web应用程序是否与您的文件:


(1)右键单击我的电脑

(2)转到属性

(3)查找计算机姓名

(4)用你的名字替换你应用中的localhost

(5)打开一个新的网络浏览器

(6)粘贴整个地址


因此:

http:// YourComputerName:YourPortNumb ... ppName.jsp(jsf


这会让你知道什么错误,如果有的话,在部署到Production App Server时存在。

注意:您可能需要禁用防火墙才能使其正常工作...


给它一个旋转,看看会发生什么。


如果不这样做,请继续关注:-)


有点!
Hey there!

I feel your pain; for I have had similar problems with Tomcat... After deployment though, you would no longer need localhost. I believe you would need your production application server name.

I would try to not package into a war file and using you computer name, as test to see if your web app interacts properly with your files:

(1) Right-Click My Computer
(2) Go to properties
(3) Find computer name
(4) Replace localhost in your app with that name
(5) Open a new web browser
(6) Paste the entire address in

Thus:

http://YourComputerName:YourPortNumb...ppName.jsp(jsf)

This would give you an idea what errors, if any, exist upon deploying to Production App Server.

Note: you may need to disable your firewall for this to work...

Give that a whirl, see what happens.

Do stay tuned if this does not do it:-)

In a bit!





我在另一个视图中提出问题。


我使用ant在Tomcat 4.1中部署应用程序(虽然这是旧版本,我正在使用它)。


我已经安装了tomcat在以下路径中
Hi,

Here I am giving my problem in another view.

I am using ant to deploy the application in Tomcat 4.1 (Though this is the older version, I am using it).

I have installed the tomcat in the following path
展开 | 选择 | Wrap | 行号


是否有人解决此问题?????



by

M. Jahabar Sadiq
Is any one having solution for this problem?????


by

M. Jahabar Sadiq


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

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