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 138554 - Installed Glassfish V3 not discovered at project creation
Summary: Installed Glassfish V3 not discovered at project creation
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vince Kraemer
URL:
Keywords:
Depends on: 141427
Blocks:
  Show dependency tree
 
Reported: 2008-06-28 17:33 UTC by _ krystyna
Modified: 2008-08-01 06:20 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch invoking the default instance registration - does not work out of the box , see comment (5.50 KB, text/plain)
2008-07-02 19:59 UTC, Petr Hejl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ krystyna 2008-06-28 17:33:43 UTC
NetBeans IDE Dev (Build 200806280102)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Windows XP version 5.1

It seems that the IDE does not recognize that the glassfish v3 server 
has been installed, and wants to install another copy.

1. Install the IDE. Accept the defaults for all three servers (apache, gf v2, gf v3tp2). (fresh userdir,
   no import of settings).
2. Create a web project. In the second screen "Servers and Setting"
>only apache and glassfish v2 are available in the dropdown 
3. User has to press Add button to discover the v3 server, chooses server "Glassfish V3 TP2", presses next.
> C:\Documents and Settings\Krystyna Polomski\GlassFish_V3_TP2 appears in installation location

There is a checkbox, unchecked, to read and accepted license agreement. If the user checks this, the
Download V3 Now button is activated. Pressing the button downloads another gf v3 in the location in
step 3. User now has 2 Glassfish v3tp2 installations. Of course, the second and unneeded download
will not be successful on Windows because of the current install-in-space issue with gf v3 tp2.

The workaround is for the user to add another server instance and override the default location and
have remembered the initial installation  C:\Sun\glassfish-v3tp2. And of course, user should not
check the agreement or press the download button.

----
I discovered that from the Menu bar, Tools > Servers > will show GF V3 immediately after an
installation. And if the user does this, then  glassfish V3 will appear in the dropdown at 
project creation, and this bug's ugly side effects will *not* occur.
Comment 1 dlipin 2008-06-30 08:10:37 UTC
Since the installer part is working fine (from the Menu bar, Tools > Servers > will show GF V3 immediately after an
installation) then reassigning to serverplugins and Vince, in person.
Comment 2 Dan Kolar 2008-06-30 16:44:47 UTC
With (Build 200806300101) I have no such problem, gf v3 is recognised in both Runtime view and upon web project
creation. But I've changed folder for server installation...
Comment 3 _ krystyna 2008-06-30 18:31:34 UTC
This does happen with the current build. Just reproduced on Mac. To reproduce it, 
at minimum you have to de-install at least the gf V3 server as well as .netbeans/dev before 
installation (clean userdir). If the first thing after installation, you attempt to create a 
project, you will reproduce the issue of not seeing gf v3 and having to add the server.
On adding the server a new default location appears. On Mac, this is, 
/Users/krystynapolomski/GlassFish_V3_TP2 along with the download button etc. etc. 
NetBeans IDE Dev (Build 200806300101)
Comment 4 Dan Kolar 2008-07-01 11:11:46 UTC
Ok, i I'm able to reproduce it. But there's simple workaround: Just go to runtime tab, and unfold Servers node. After
that, both servers are shown upon creating new web project.
Comment 5 Vince Kraemer 2008-07-01 18:49:20 UTC
I can reproduce this.

The problem appears to be related to the server registries...

When the wizard opens, the j2eeserver's ServerRegistry is initialized and that registry is used to populate the server
selection combo box.

The initialization of the j2eeserver ServerRegistry doesn't seem to trigger the initialization of the server
ServerRegistry (which is where the GF V3 server gets registered).... and the V3 instance is not registered in the IDE
until after the server ServerRegistry is is initialized...

It looks like the "easy" fix is to make the j2eeeserver ServerRegistry initialization depend on the server
ServerRegistry... but that seems like it is probably wrong.

Petr H: please comment and reassign to me, if there is a code change in glassfish.* code that will resolve this.
Comment 6 Petr Hejl 2008-07-02 19:56:02 UTC
Hi Vince,
I believe the registration of the default instance should be done with static initializer not in provider constructor.
J2ee DeploymentFactory can invoke class initialization of the provider.

Now the important part - the patch as it is does not work - actually it introduces exception. The trouble is in
following code path:

ServerRegistry.init() ->
....
Hk2DeploymentFactory.create() ->
ServerUtilities.getServerProvider() ->
GlassFishInstanceProvider.<init> ->
GlassFishInstanceProvider.registerDefaultInstance() ->
GlassFishInstance.create() ->
GlassFishInstance.<cinit> ->
GlassFishInstance.updateModuleSupport() ->
JavaEEServerModuleFactory.createModule() ->
InstanceProperties.createInstancePropertiesWithoutUI()

As you see the plugin is trying to register instance (the last line), but registry is not yet initialized (the first
line). So I think GlassfishModuleFactory should provide some method to such default server registration (you can see
JBoss or Tomcat for J2ee default server registration). Maybe there is a way to just write common info and J2EE info
without even creating the GlassfishInstance object. Right now I can't propose complete solution, but I believe this
should be solved in GFv3 plugin.

I know it is bit complicated and we can get back to this and design some general simplification (if possible). It is
however needed to preserve j2ee compatibility.
Comment 7 Petr Hejl 2008-07-02 19:59:21 UTC
Created attachment 63843 [details]
patch invoking the default instance registration - does not work out of the box , see comment
Comment 8 Vince Kraemer 2008-07-09 17:59:49 UTC
wrong milestone value.
Comment 9 Vince Kraemer 2008-07-31 05:18:50 UTC
http://hg.netbeans.org/main/rev/2f88c7fbff41
Comment 10 Quality Engineering 2008-07-31 15:43:54 UTC
Integrated into 'main-golden', available in build *200807311401* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/2f88c7fbff41
User: Vince Kraemer <vkraemer@netbeans.org>
Log: #138554 : use new api to finish initialization of the plugin
Comment 11 _ krystyna 2008-08-01 06:20:32 UTC
Verified on WinXP with installer build 200807311401.