简体   繁体   English

Eclipse与Tomcat的交互-无法取消部署应用程序

[英]Eclipse interaction with Tomcat - cannot undeploy applications

My problem is that if I use Eclipse to deploy my Web Application (via Run As->Run Server), I cannot undeploy it, as within Tomcat Manager the undeploy link against the Application is not highlighted. 我的问题是,如果使用Eclipse部署Web应用程序(通过“运行方式”->“运行服务器”),则无法取消部署它,因为在Tomcat Manager中,未突出显示针对该应用程序的取消部署链接。 If I manually put in the URL I get the following Error: 如果手动输入URL,则会出现以下错误:

FAIL - Context /TomcatBasic is defined in server.xml and may not be undeployed 失败-上下文/ TomcatBasic是在server.xml中定义的,不能取消部署

Im using Eclipse Galileo, and Tomcat 6.0.20 我正在使用Eclipse Galileo和Tomcat 6.0.20

The steps I have followed are: 我遵循的步骤是:

1) Within Eclipse, I use the Server view, to create a new Tomcat Server. 1)在Eclipse中,我使用“服务器”视图来创建新的Tomcat服务器。

However by default when you "Run Server", it seems that applications are run within Eclipse ? 但是默认情况下,当您“运行服务器”时,似乎应用程序是在Eclipse中运行的? When looking at the Tomcat Manager no application was deployed even though Eclipse was running it 在查看Tomcat Manager时,即使Eclipse正在运行,也没有部署任何应用程序

To overcome this I did the following. 为了克服这个问题,我做了以下工作。 In the Servers view within Eclipse: - Right click on the Tomcat Server, and select Properties. 在Eclipse的“服务器”视图中:-右键单击Tomcat服务器,然后选择“属性”。 In the Properties window I clicked the button "Switch Location". 在“属性”窗口中,单击“切换位置”按钮。 - Right click on the Tomcat Server, and select open. -右键单击Tomcat服务器,然后选择“打开”。 In the following dialog box I modified "Server Location" to select "Use Tomcat installation", and then I change the "Server path" to C:/apache-tomcat-6.0.20 and the "Deploy path" to C:/apache-tomcat-6.0.20 在下面的对话框中,我修改了“服务器位置”以选择“使用Tomcat安装”,然后将“服务器路径”更改为C:/apache-tomcat-6.0.20,将“部署路径”更改为C:/ apache -tomcat-6.0.20

2) Create a Dynamic Web Application. 2)创建一个动态Web应用程序。

In the "New Dynamic Web Project" windown I select Apache Tomcat as the "Target Runtime" and "Configuration". 在“ New Dynamic Web Project”窗口中,我选择Apache Tomcat作为“ Target Runtime”和“ Configuration”。 Click Finish. 单击完成。

3) Right click on the project and "Run As" -> "Run on Server". 3)右键单击项目,然后单击“运行方式”->“在服务器上运行”。

The application now gets deployed to the Tomcat Application Server as required. 现在,可以根据需要将应用程序部署到Tomcat应用程序服务器。 HOWEVER I cannot undeploy it when I log onto Tomcat Manager. 但是,当我登录Tomcat Manager时不能取消部署它。

Any help please will be greatly appreciated ! 任何帮助,请不胜感激!

You can do this from within the UI. 您可以从用户界面中执行此操作。

Within eclipse, in the Package Explorer you can see the Servers along with the other projects. 在eclipse中,在Package Explorer中,您可以看到服务器以及其他项目。

1) Stop the tomcat runtime. 1)停止tomcat运行时。

2) Package Explorer > Servers > Tomcat7 > Server.xml 2)包资源管理器>服务器> Tomcat7> Server.xml

Here search for <Context> tag and delete the one corresponding to the web application you would like to undeploy. 在这里搜索<Context>标记,并删除与您要取消部署的Web应用程序相对应的标记。

3) Make sure save the server.xml file and close it. 3)确保保存server.xml文件并关闭它。

4) you are good to go. 4)你很好。

At least this worked for me :-). 至少这对我有用:-)。

I think all you need to do is manually undeploy the webapp under the directory that eclipse is deploying it to.. .metadata.plugins\\org.eclipse.wst.server.core 我认为您需要做的只是手动取消部署eclipse部署到的目录下的webapp。..metadata.plugins \\ org.eclipse.wst.server.core

if you have to you can also edit the servers.xml file.. you should find it at: 如果需要,还可以编辑servers.xml文件。您应该在以下位置找到它:

.metadata.plugins\\org.eclipse.wst.server.core\\tmp0\\conf\\servers.xml .metadata.plugins \\ org.eclipse.wst.server.core \\ tmp0 \\ conf \\ servers.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM