This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197067

Summary: Compile on Save broken in J2EE App
Product: javaee Reporter: bht <bht>
Component: Web ProjectAssignee: David Konecny <dkonecny>
Status: RESOLVED FIXED    
Severity: normal CC: phejl, pjiricka, vkraemer
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: the patch

Description bht 2011-03-24 21:10:43 UTC
First I checked what to expect from GlassFish 3.1

Console|Domain|Applications Configuration
Enable reloading so that changes to deployed applications are detected and the modified classes reloaded.
Reload Poll Interval: 2 seconds

Here is what I did to reproduce the problem:

Load project from http://netbeans.org/bugzilla/show_bug.cgi?id=181173
zip file
http://netbeans.org/bugzilla/attachment.cgi?id=94576
unzip and open project.

- Application compile on save on, deploy on save off
- Server Preserve sessions across deployments on
- Start server in debug mode
- Clean and build application
- Deploy application

Locate class file MySignInPage.class and take note of modification date

Open/Edit MySignInPage.java
Make a change and save

	public MySignInPage()
	{
        System.out.println("Hello");
	}

Locate class file MySignInPage.class and take note of modification date

Expected results:
a) modification date should change
b) GlassFish should detect change and re-deploy class within 2 seconds

Actual Result:
Modification date is not changed because the class was not recompiled.

I am suggesting to continue with classfile modification outside NetBeans for further clarification.
Comment 1 bht 2011-03-24 21:52:21 UTC
I try to view the corresponding page and see what happens if I compile the file manually.

Wicket Menu|authentication|Admin Page
Viewing this page displays the text in the GlassFish log.

GlassFish does not detect the changes even if the file is compiled manually via single file compile.

I would expect the single class file to be re-loaded. Is that not posssible?
Comment 2 Vince Kraemer 2011-03-24 22:14:54 UTC
You may want to read the docs about Dynamic application reloading... http://download.oracle.com/docs/cd/E18930_01/html/821-2417/gilfm.html#fwakh

Assigning to Petr H to look into the class-file timestamp aspect of this issue.
Comment 3 Petr Hejl 2011-03-25 12:28:01 UTC
Created attachment 107279 [details]
the patch

I think this is relict of Dos to CoS+DoS split where build scripts haven't been updated. Attaching patch and passing to David.

Not sure if this is P2 - bht will it fix the original use case or there is other issue with GF.
Comment 4 bht 2011-03-25 18:10:20 UTC
I just found this while checking the file attributes. It will not fix the original use case, so not really P2 because of that.

I don't think there is another issue with GF due to this from my current perspective.
Comment 5 Petr Hejl 2011-03-25 18:40:15 UTC
Ok, then. Decreasing to P3.
Comment 6 David Konecny 2011-04-05 00:56:45 UTC
PetrH, thanks for the patch. I'm looking at it and it seems to do the trick but it does not seem very logical: for example in web.project - why 'deploy.on.save' should be set even if only 'j2ee.compile.on.save' is set to true? Which code is actually using 'deploy.on.save'? I could not find any reference to it in build-impl.xml. I think I'm missing something. :-)
Comment 7 Petr Hejl 2011-04-05 08:58:28 UTC
(In reply to comment #6)
> PetrH, thanks for the patch. I'm looking at it and it seems to do the trick but
> it does not seem very logical: for example in web.project - why
> 'deploy.on.save' should be set even if only 'j2ee.compile.on.save' is set to
> true? Which code is actually using 'deploy.on.save'? I could not find any
> reference to it in build-impl.xml. I think I'm missing something. :-)

IIRC it is used by javac redefined by jlahoda so it really put the classes to build dir. J2SE does not need it as the classes remain in cache and only the run classpath is modified. Our EE apps however need predefined structure, ie. WEB-INF/classes. The name is result of the original design - DoS or nothing.
Comment 8 David Konecny 2011-04-05 19:59:05 UTC
Thanks for the clarification Petr.
353d7768039e
Comment 9 David Konecny 2011-04-05 21:18:50 UTC
*** Bug 197106 has been marked as a duplicate of this bug. ***
Comment 10 David Konecny 2011-04-05 22:50:48 UTC
*** Bug 197106 has been marked as a duplicate of this bug. ***
Comment 11 David Konecny 2011-04-06 22:43:41 UTC
I forgot to close this yesterday. Petr's patch was applied.
Comment 12 Quality Engineering 2011-04-07 08:45:21 UTC
Integrated into 'main-golden', will be available in build *201104070400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/353d7768039e
User: David Konecny <dkonecny@netbeans.org>
Log: #197067 - Compile on Save broken in J2EE App