Performing this task will resolve a problem that occurs when
using NetBeans to configure a JDBC Connection Pool and JDBC Resource
for GlassFish. The default installation of NetBeans and GlassFish
results in the naming of the JDBC configuration file as "sun-resources.xml"
when it should be named "glassfish-resources.xml".
This is a Windows-only problem.
The first step is to install NetBeans if you have not already done so. I recommend the Java EE version. Download and install. All the defaults during install are acceptable. Install GlassFish but it is not necessary to install Tomcat.
When GlassFish is installed with NetBeans it is configured as available to NetBeans. You can see this in the Services tab under Servers.
Note: While this instance of the GlassFish server will perform as expected when creating web or EJB applications I have uncovered an issue with the naming of configuration files used to configure GlassFish JDBC Connection Pools and JDBC Resources on system running Windows. While the specific name is not significant it leads to problems when tutorials or classroom presentations are used that do not match your actual experience. This is what happened to me in class just the other day!
To resolve this problem we must remove the existing GlassFish server from NetBeans and then add it back with a new location for the domain folder. Begin by right mouse-clicking on the GlassFish Server 4.1 and select Remove.
Click on Yes in this dialog.
Now we need to put back the server. Right mouse click on Servers and select Add Servers.
You should now see:
Select GlassFish server and click on Next. Feel free to give the server a more exciting name than GlassFish Server.
This dialog shows the Installation Location where GlassFish was installed with NetBeans. If for some reason it is not then Browse to the correct location. Leave the choice of Local Domain. Click on Next.
The domain folder created when GlassFish is installed with NetBeans is the cause of the problem we are solving by creating a new server. You cannot easily change the domain folder once it is associated with a server in NetBeans so that is why we need to create a new server.
The location that is the cause of the problem is simply called ‘domain1’. If this appears in the Domain box then replace it with an absolute path such as what appears in my image. Any path should be acceptable. I avoid paths with spaces in the names.
You can leave the Target box blank.
By default there is no password for a GlassFish domain. Therefore you can leave User Name and Password blank. Click on Finish. The following dialog will pop up. This will not be the case on a production server.
Either answer is acceptable. Your new server should appear under Servers.
To test that all is well right mouse click on GlassFish Server and select Start.
After a few seconds you should see the following.
You are now ready to write your application!