Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334977

Summary: When WTP published a jsp on / context project, whole tomcat work directory is removed and regenerated
Product: [WebTools] WTP ServerTools Reporter: Son KwonNam <kwon37xi>
Component: jst.serverAssignee: Larry Isaacs <larryisaacs>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: brian, josh
Version: unspecified   
Target Milestone: 3.6.3   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/109256
Whiteboard:
Attachments:
Description Flags
normalize "/" to "" inside WebModule module to match behavior elsewhere larryisaacs: iplog+

Description Son KwonNam CLA 2011-01-21 02:10:49 EST
Build Identifier: 20100917-0705

On a / context project, when WTP published a jsp whole tomcat workd directory is removed.
It does not happen when project context root is other than "/".
(I think) Because of this, sometimes tomcat classloader cannot load JSP generated class.

I use tomcat 6.0.30. WTP 3.2.2.v201008170019-377AB8s73533J5H335L

Reproducible: Always

Steps to Reproduce:
1. create Dynamic Web project
2. set Web context root as "/"
3. edit a jsp file and save.
4. check tomcat work directory. the .metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/_ directory is removed.
5. request jsp page on a web browser.
6. .metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/_ directory is regenerated.

This phenomenon does not happen when a context root is other than "/".
Comment 1 Joshua Chaitin-Pollak CLA 2012-04-06 18:51:01 EDT
I can confirm this issue on a Mac with Eclipse Indigo Service Release 2 and apache-tomcat-6.0.33
Comment 2 Brian Gardner CLA 2014-11-22 17:08:46 EST
Created attachment 248841 [details]
normalize "/" to "" inside WebModule module to match behavior elsewhere

This problem has been plaguing me for years so I finally decided to look into it.  I must say I'm very impressed at how easy it was to pull the latest webtools.servertools.git and debug this project.

Looks like the root of the problem is around line 669 of TomcatVersionHelper.java where it normalizes "/" to "".  This causes getRemovedKeptCatalinaContexts to treat the module deployed to "/" as a brand new module because its comparing "/" from the eclipse configuration to "" from the deployed and transformed (see line 669) configuration.


I'm not familiar enough with the code to know the right thing to do, so I tried to keep my change isolated to the problem.  I could of used a ternary but I'm not sure what the sentiment around those are.
Comment 3 Brian Gardner CLA 2014-11-22 18:24:02 EST
NOTE: I am in compliance with the Eclipse Foundation Contributor’s Certificate of Origin
Comment 4 Brian Gardner CLA 2014-11-30 22:28:11 EST
Is there anything I need to do to get my patch reviewed and integrated?
Comment 5 Larry Isaacs CLA 2014-12-01 10:43:29 EST
Hi Brian, I have limited time available for WTP, but will have some time over the holidays.  I will try to have this addressed during that time, if not sooner.
Comment 6 Larry Isaacs CLA 2015-01-06 09:35:02 EST
Comment on attachment 248841 [details]
normalize "/" to "" inside WebModule module to match behavior elsewhere

Updating iplog flag.
Comment 7 Larry Isaacs CLA 2015-01-06 09:39:56 EST
The patch has been applied to WTP 3.6.x and 3.7.x builds and will appear in WTP 3.6.3 and 3.7.0.  Thanks for the patch.
Comment 8 Eclipse Genie CLA 2017-10-11 16:43:02 EDT
New Gerrit change created: https://git.eclipse.org/r/109256