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 228433 - Start GF domain on JDK chosen in IDE installer
Summary: Start GF domain on JDK chosen in IDE installer
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.3.1
Hardware: All All
: P2 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on: 229001
Blocks: 227371
  Show dependency tree
 
Reported: 2013-04-10 10:14 UTC by Jiri Rechtacek
Modified: 2013-04-26 02:45 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
JDK 6 in IDE (37.08 KB, image/png)
2013-04-10 10:14 UTC, Jiri Rechtacek
Details
warning about JDK 6 for GF4 (45.92 KB, image/png)
2013-04-10 10:15 UTC, Jiri Rechtacek
Details
correct JDK 7 for GF4 (36.32 KB, image/png)
2013-04-10 10:16 UTC, Jiri Rechtacek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Rechtacek 2013-04-10 10:14:34 UTC
Created attachment 133412 [details]
JDK 6 in IDE

See the issue 227371 for a background.

Steps for reproduce:
1) run NB7.3.1 installer (javaee or full distro)
2) choose JDK 6 as JDK for IDE (see chosen_jdk6_for_ide.png)
3) the installer will warn the user the GF4 requires JDK 7 or newer (see insufficient_jdk6_for_gf4.png)
4) the user can choose JDK 7 for starting GF4 server (see correct_jdk7_for_gf4.png)
5) the installer hands over the JDK 7 (if differs to JDK for IDE) for glassfish AutoRegistation, it writes down the JDK path to the attribute java.platform of glassfish_autoregistered_instance
6) start the IDE and switch to Services|Servers
=> the chosen JDK from IDE is not in the properties of GlassFish Server 4.0

glassfish.common has to read the java.platform attribute if it's not empty and start the GF4 domain using this JDK
Comment 1 Jiri Rechtacek 2013-04-10 10:15:39 UTC
Created attachment 133413 [details]
warning about JDK 6 for GF4
Comment 2 Jiri Rechtacek 2013-04-10 10:16:01 UTC
Created attachment 133414 [details]
correct JDK 7 for GF4
Comment 3 TomasKraus 2013-04-10 10:30:21 UTC
Looks like java.platform attribute is not being saved/loaded in GlassfishInstanceProvider. this should be fixed.
Comment 4 TomasKraus 2013-04-10 16:08:25 UTC
Checked into web-main:
----------------------
changeset:   250105:6725de5bd527
branch:      javaee7
summary:     #228433 - Save and load GlassFish instance attributes
             after properties being changed

changeset:   250106:70501ddcbc30
branch:      javaee7
summary:     #228433 - Fixed build issues

This change made plugin to save server data after editing properties.
That's the only way how to get java.platform attribute in properties file for server registered from wizard.

I saw that java.platform value was restored correctly after netbeans were restarted.
Comment 5 Jiri Rechtacek 2013-04-15 13:56:55 UTC
Fixed in trunk - http://hg.netbeans.org/core-main/rev/2cbbafb6d1c9
Transplanted to release73 - http://hg.netbeans.org/releases/rev/0f4ae5474e71
Comment 6 Jiri Rechtacek 2013-04-16 15:08:06 UTC
It still doesn't work correctly. Steps to reproduce with today's build NetBeans IDE 7.3.1 Dev 201304152201
1) run the installer
2) choose JDK 6 as JDK for IDE
3) choose JDK 7 as JDK for GlassFish
4) start IDE
5) open popup menu over Services|Server|GlassFish Server 4.0
6) invoke Start
==> GlassFish starts on JDK 7

but the scenario bellow doesn't work
1) run the installer
2) choose JDK 6 as JDK for IDE
3) choose JDK 7 as JDK for GlassFish
4) start IDE
5) open popup menu over Services|Server|GlassFish Server 4.0 (the same as before)
6) open Properties and close w/o any modification
7) open popup menu over Services|Server|GlassFish Server 4.0 again
8) invoke Start
==> GlassFish won't start, only a dialog for browsing JDK 7 is shown
Comment 7 Quality Engineering 2013-04-17 00:20:01 UTC
Integrated into 'releases', will be available in build *201304162201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/6725de5bd527
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #228433 - Save and load GlassFish instance attributes after properties being changed
Comment 8 Quality Engineering 2013-04-18 02:20:29 UTC
Integrated into 'main-golden', will be available in build *201304172301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2cbbafb6d1c9
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #228433: Start GF domain on JDK chosen in IDE installer
Comment 9 TomasKraus 2013-04-19 12:48:18 UTC
JDK chosen from installer is not registered as java platform in NetBeans and properties editor will not find it. That's why this value is lost.
Comment 10 TomasKraus 2013-04-19 13:40:37 UTC
Optimal solution is to register JDK selected for GlassFish as a platform in 
NetBeans. But it should be done in installer itself.
JDK unknown to platform manager is replaced with default platform.

In Bug# 228451 I was asked to follow behavior of platform manager so I removed code that was able to manage platforms not registered in platform manager and that allowed to keep stored value untouched even when it was not registered.
Comment 11 TomasKraus 2013-04-19 13:55:48 UTC
Closing this as resolved, Java platform for GlassFish should be registered in NetBeans from installer. It will be then recognized properly by properties editor.
Comment 12 Jiri Rechtacek 2013-04-19 13:56:41 UTC
(In reply to comment #11)
> Closing this as resolved, Java platform for GlassFish should be registered in
> NetBeans from installer. It will be then recognized properly by properties
> editor.

I don't think it's good idea to mix up registration of Java Platforms in IDE (primarily purpose is for developing Java-based applications) with JDK for running runtimes bundled with IDE. Can be JDK for GF independent of JDK for Java application?
Comment 13 TomasKraus 2013-04-19 14:01:40 UTC
Well, I'm afraid that I'm not the one to decide this. I would like to see opinion of Petr Hejl / Petr Jiricka before implementing such a thing.
Comment 14 Petr Hejl 2013-04-19 14:13:35 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > Closing this as resolved, Java platform for GlassFish should be registered in
> > NetBeans from installer. It will be then recognized properly by properties
> > editor.
> 
> I don't think it's good idea to mix up registration of Java Platforms in IDE
> (primarily purpose is for developing Java-based applications) with JDK for
> running runtimes bundled with IDE. Can be JDK for GF independent of JDK for
> Java application?

My opinion is this would not mix anything up. Quite the opposite. The JDK GF is running on is the JDK for developing apps.

Also there is no concept of runtime platforms and development platforms so far. Seems to be weird for the user to select the JDK for GF and later to configure it once again in the IDE in order to develop EE7 apps on JDK7. Am I missing something? Registering JDK does not do any harm but certainly may help the user.
Comment 15 Tomas Zezula 2013-04-22 08:21:21 UTC
The best places to create the needed JDK 7 platform are the entry points of the GF integration module.
Installer should not create the platform as the platform will be created even for users who don't need it and it may be strange from user point of view.
Comment 16 TomasKraus 2013-04-22 09:30:06 UTC
The only entry point in the plugin is instance provider where stored instances are being loaded.
I can register platform if it's home directory is not registered and it's valid JDK.
Comment 17 Tomas Zezula 2013-04-22 09:35:44 UTC
There is a friend API to create a new J2SEPlatform in the java.j2seplatform module,
the class is org.netbeans.modules.java.j2seplatform.api.J2SEPlatformCreator
I will need to add the module among the friend modules.
What is the module name?
Comment 18 TomasKraus 2013-04-22 09:39:12 UTC
It's glassfish.commonm (org.netbeans.modules.glassfish.common).
Comment 19 TomasKraus 2013-04-22 14:51:57 UTC
checked into web-main:
----------------------
changeset:   251172:171ec915234c
branch:      javaee7
summary:     #228433 - Register unknown Java platform in plugin

This will register platform stored in GF properties when it's unknown to platform manager.
Comment 20 Quality Engineering 2013-04-25 00:18:30 UTC
Integrated into 'releases', will be available in build *201304242201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/171ec915234c
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #228433 - Register unknown Java platform in plugin
Comment 21 Jiri Rechtacek 2013-04-25 13:14:19 UTC
Verified in:

  Product Version         = NetBeans IDE 7.3.1 (Build 201304242201) (#8d14d57eeddb)
  Operating System        = Linux version 3.0.0-32-generic running on i386
  Java; VM; Vendor        = 1.6.0_41; Java HotSpot(TM) Client VM 20.14-b01; Sun Microsystems Inc.
  Runtime                 = Java(TM) SE Runtime Environment 1.6.0_41-b02
  Java Home               = /usr/local/share/java/jdk1.6.0_41/jre
Comment 22 Quality Engineering 2013-04-26 02:45:43 UTC
Integrated into 'main-golden', will be available in build *201304252301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/171ec915234c
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #228433 - Register unknown Java platform in plugin