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

Bug 339983

Summary: Eclipse Refreshing Synchronization Problem
Product: [WebTools] Web Tools Reporter: dmachop
Component: J2EE Standard ToolsAssignee: jst-inbox <jst-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact: Chuck Bridgham <cbridgha>
Severity: critical    
Priority: P3 CC: arvera, prakash
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description dmachop CLA 2011-03-15 05:18:42 EDT
Build Identifier: 20100218-1602

I use eclipse Build id: 20100218-1602. Server WASCE 2.1. I use a dynamic web project.
I use an xml file fetch_movie.xml to fetch movies of a particular date clicked on index.jsp file. So, the javascript code calls a servet which fetches from database and writes it into fetch_movie.xml file. When viewing from the normal folder view in Windows, the file gets updated but does not change from the project folder view. So, I've run into this problem.

One of solution is to set eclipse Project Settings to Refresh automatically. I did that. But since my project involves usage of sessions and each time it takes a lot of time to refresh, this one does not help me!!!

Reproducible: Always

Steps to Reproduce:
1.Create a Dynamic Web projects with .jsp,servlet,.xml files.
2.Make the servlet write to .xml file.
3.The js reads from the unupdated .xml file and displays the older data.  Thus not updated.
Comment 1 Angel Vera CLA 2011-03-17 14:29:18 EDT
If I understand the problem correctly,....

As long as the xml file is updated in the file system, the javascript running from the server should be able to pick up the change as the file has been updated in the filesystem. 

I believe that once the IDE has open the xml file in an editor, it keeps a in memory state of the file, and if the file changes outside of IDE, the IDE would not know.

I am not entirely sure of the properties of the WASCE in terms of how it handles the publishing of the files from your dynamic web project (ie, if it copies the resources to a temporary location or just run them from the project location). But I wouldn't think it matters, can you try with Tomcat? 

Providing a testcase would also help with the faster resolution.
Comment 2 dmachop CLA 2011-03-20 04:01:05 EDT
(In reply to comment #1)
> If I understand the problem correctly,....
> 
> As long as the xml file is updated in the file system, the javascript running
> from the server should be able to pick up the change as the file has been
> updated in the filesystem. 
> 
> I believe that once the IDE has open the xml file in an editor, it keeps a in
> memory state of the file, and if the file changes outside of IDE, the IDE would
> not know.
> 
> I am not entirely sure of the properties of the WASCE in terms of how it
> handles the publishing of the files from your dynamic web project (ie, if it
> copies the resources to a temporary location or just run them from the project
> location). But I wouldn't think it matters, can you try with Tomcat? 
> 
> Providing a testcase would also help with the faster resolution.

Well, in that case what I observed was the same set of code worked in a different IDE [Netbeans with Glassfish 3].
Clarification in terms of the working of the WASCE server -- the server copies into the directory C:\Program Files\IBM\WebSphere\AppServerCommunityEdition\var\project name\files.xml where the file is not updated when compared with the project directory.
But no success there running glassfish too.

I think that the problem with Eclipse is the auto-refresh which takes too much time to update the project view in the IDE.
Comment 3 Angel Vera CLA 2011-03-31 13:21:06 EDT
I think you are running into a problem particular problem that might be hard to fix. The actual problem is not eclipse but rather the server adapters code, it is even arguable to say that this is a server adapter problem. 

Allow me to give you the convoluted answer first...

The Eclipse IDE is very flexible interms of how a project can be structured by a user (it allows link resources, multiple source folder, multiple output folders, ...) In some cases (not all) some server adapter can't interpret the layout of an EAR Project, Dynamic Web project or similars, as it is configured by the user, or as it is  layout in the file system. It is in this cases were server adapter will require to make a read your project files, and copy them into a format that the server adapter can interpret them. Since the files are actually copied to a different temp location (sometimes this temp location is the actual server deployed application path) the server doesn't use the files from the project directly. 

It is because of this copy effect that you experiencing this problem. So far I haven't seen any server adapter that refreshes the file that are copied into this temp location back to the location of the project. Meaning that this copy process is a one way street.

I would suggest talking to the server adapter directly and see how if they would be willing to provide an option where the files are always kept in sync in both side, no matter where the update came from. 

I am closing this bug as NOT_ECLIPSE