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 240403 - GlassFish registration removed after restart when registered by installer
Summary: GlassFish registration removed after restart when registered by installer
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-13 10:21 UTC by Jiri Skrivanek
Modified: 2014-01-15 11:54 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the patch (995 bytes, patch)
2014-01-13 21:04 UTC, Petr Hejl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2014-01-13 10:21:53 UTC
GlassFish registration is lost after restart if it was previously registered during installation. To reproduce:

- install NetBeans with GlassFish and Tomcat from installer
- start NetBeans
- create Web project with GlassFish, check server at the Services view
- restart NetBeans
- look at the Services view but server is gone
- if you try to add server again it does not offer path to installed Glassfish (see bug 239173).

Product Version: NetBeans IDE 8.0 Beta (Build 201401091443)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b65
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b123
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jskrivanek\AppData\Roaming\NetBeans\8.0beta
Cache directory: C:\Users\jskrivanek\AppData\Local\NetBeans\Cache\8.0beta
Comment 1 Marian Mirilovic 2014-01-13 10:40:04 UTC
Tomas, 
please evaluate ASAP (today!) and let us know .... otherwise we will release 8.0 with this bug, thanks in advance.
Comment 2 Jiri Rechtacek 2014-01-13 15:07:18 UTC
A problem is related to preferences of glassfish module, stored in file <userdir>/config/Preferences/org/netbeans/modules/glassfish/common.properties 

If the file found in the userdir, GF4 server is not in Services tab. When I removed the file and restarted IDE, the GF4 was back in Services tab. After next restart will disappear again and so on.
Comment 3 Jiri Rechtacek 2014-01-13 15:07:53 UTC
Btw. it's reproducible on latest Dev build on Windows and on Mac too.
Comment 4 Petr Hejl 2014-01-13 21:03:54 UTC
I think I've found a fix. If my assumptions are correct this used to work only by accident in 7.4.

Basically there is a logic which for some reason copy the data from autoregistered instance file to a regular one and saving the mark it has been done. There is also logic that prevents duplicated instance files.

In 7.4 the autoregistered instance was in folder GlassFishEE6WC and the regular instance file was created in GlassFishEE6 in userdir.

In dev the autoregistered instance is in folder GlassFishEE6 and the regular instance file is going to be created in GlassFishEE6 in userdir. So the duplication prevention code takes place and the instance is not stored in user dir, but marked as copied.

I believe the attached patch could solve the issue though I'm not sure about possible side effects - the GF code is too complex.
Comment 5 Petr Hejl 2014-01-13 21:04:35 UTC
Created attachment 143924 [details]
the patch
Comment 6 Petr Hejl 2014-01-14 09:28:49 UTC
Fixed in web-main add2166c0cda.
Comment 7 Jiri Rechtacek 2014-01-14 09:37:19 UTC
Fixed in 8.0_beta - http://hg.netbeans.org/releases/rev/d6258d35641d
Comment 8 TomasKraus 2014-01-14 10:20:40 UTC
Fix looks good. Values of instance.url and instance.name are unique so this shall be working.

I would just replace instanceFOs[i].getAttribute(GlassfishModule.URL_ATTR)) with instanceFOs[i].getUrl(). I made all those getters and setters to hide backend map and to allow getting rid of it in the future. But it's just a cosmetic change so it's up to you.
Comment 9 Jiri Skrivanek 2014-01-15 11:54:55 UTC
Verified in NetBeans IDE 8.0 Beta (Build 201401141042).