Using NetBeans IDE together with GlassFish works like a charm. Especially when using the preconfigured GlassFish. There is one point which isn't mentioned a lot... you can also work with a remote GlassFish.
When planning to use this feature, you'll have to switch to the "Services" window in NetBeans IDE. Within this, you should choose a new GlassFish instance to be added to the servers:
Within the next page, you've got to choose a locally installed instance:
This is needed so that NetBeans IDE can use the libraries provided by GlassFish. It shoud be the same version of GlassFish as the one on the web server, to avoid any problems.
The next step is the one where the remote instance is chosen. By default, the local instance is chosen, but we'll choose the other now:
After entering the information, everything should be fine, but there is still one step. Due to security restrictions, the remote administration of the GlassFish isn't enabled. So when you click on OK you receive the following dialog:
This dialog gives you a hint on what to do next. You have to execute "asadmin enable-secure-admin" on the remote server:
[webserver]# asadmin enable-secure-admin
Enter admin user name> [your admin-user, default: "admin"]
Enter admin password for user "admin"> [the password of this user]
Command enable-secure-admin executed successfully.
Now you can try again, but you will still receive the same error. According to the documentation, Grizzly needs a reload to apply these settings.
After you've enabled-secure-admin, you will be asked to confirm a new certificate (on the console, which you should do). This command enables secure access to the admin functions. That means that the admin-gui (on port 4848) is now running via https and is no longer avaliable using http. The communication between asadmin and GlassFish is now secured.
After stopping and starting GlassFish again, everything works fine. And now you can work with the remote GlassFish.