在Eclipse中更改Web项目的Tomcat上下文路径 [英] Changing Tomcat context path of web project in Eclipse

查看:1855
本文介绍了在Eclipse中更改Web项目的Tomcat上下文路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Tomcat 6并使用Eclipse中的Servers功能进行管理。我有一个名为foobar的项目,我想更改上下文路径,以便引用的URL是 http:// localhost: 8080 / app ,而不是 http:// localhost:8080 / foobar 。我已经尝试过我可以想到的一切:




  • 更新了Context部分中的server.xml路径值



 <上下文docBase =foobar path =/ foobaroadable =truesource =org.eclipse.jst.j2ee.server:foobar/>< / Host> 

 < Context docBase =foobarpath =/ appoadable =truesource =org.eclipse.jst.j2ee.server:foobar/>< / Host> 





我知道我可以简单地重命名该项目,但我不想。





编辑:



我在应用程序上下文中有一些数据库设置。我不确定是否应该设置为foobar.xml或app.xml ..? Eclipse会自动在conf / Catalina / localhost中创建一个app.xml文件,但在进行更改后似乎被忽略。

解决方案


  1. 在项目属性中,单击 Web项目设置(假设您处于动态Web项目中)。唯一的配置值是Context root:

  2. 将上下文根更改为/ app

  3. rebuild

  4. 从tomcat中删除项目

  5. 重新部署。


I'm using Tomcat 6 and using the Servers functionality in Eclipse to manage it. I have a project named foobar and I'd like to change the context path so that the URLs referenced are http://localhost:8080/app instead of http://localhost:8080/foobar. I've tried everything that I can think of:

  • Updated the server.xml path value in the Context section

From

<Context docBase="foobar" path="/foobar" reloadable="true" source="org.eclipse.jst.j2ee.server:foobar"/></Host>

To

<Context docBase="foobar" path="/app" reloadable="true" source="org.eclipse.jst.j2ee.server:foobar"/></Host>

I know that I can simply rename the project, but I don't want to.

EDIT:

I also should mention that I have some db settings in the application context. I am unsure if this should be set to foobar.xml or app.xml..? Eclipse automatically creates an app.xml file in conf/Catalina/localhost, but it seems to be ignored after I make changes.

解决方案

  1. In project properties click on Web Project Settings (assuming you are in a dynamic web project.) The only configuration value there is "Context root:"
  2. change "Context root" to /app
  3. rebuild
  4. remove the project from tomcat
  5. redeploy.

这篇关于在Eclipse中更改Web项目的Tomcat上下文路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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