Java Platform, Enterprise Edition

Java EE Journal

Subscribe to Java EE Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Java EE Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


J2EE Journal Authors: Stackify Blog, Sumith Kumar Puri, Javier Paniza, Yakov Fain, Ken Fogel

Related Topics: Java EE Journal, Intel XML, XML Magazine, Java Developer Magazine, Java in the Cloud, Internet of Things Journal

Blog Feed Post

A New Instance of GlassFish in NetBeans By @OmniProf | @ThingsExpo [#IoT]

When GlassFish is installed with NetBeans it is configured as available to NetBeans

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.

Image0119

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 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.

Image0219

Click on Yes in this dialog.

Image0319

Now we need to put back the server. Right mouse click on Servers and select Add Servers.

Image0419

You should now see:

Image0519

Select GlassFish Server and click on Next. Feel free to give the server a more exciting name than GlassFish Server.

Image0619

 

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.

Image0719

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.

Image0819

Either answer is acceptable. Your new server should appear under Servers.

Image0919

To test that all is well right mouse click on GlassFish Server and select Start.

Image1019

After a few seconds you should see the following.

Image1119

You are now ready to write your application.

More Stories By Ken Fogel

In 1980 I bought for myself the most wonderful toy of the day, the Apple ][+. Obsession followed quickly and by 1983 I was writing software for small and medium sized businesses in Montreal for both the Apple and the IBM PC under the company name Omnibus Systems. In the evenings I taught continuing education courses that demystified the computer to the first generation of workers who found themselves with their typewriter on the scrap heap and a PC with WordStar taking its place.

In 1990 I was invited to join the faculty at Dawson College in the Computer Science Technology program. When I joined the program the primary language was COBOL and my responsibility was to teach small systems languages such as BASIC and C/C++.

Today I am now the chairperson and program coordinator of the Computer Science Technology program at Dawson. The program's primary language is Java and the focus is on enterprise programming.

I like to write about the every day problems my students and I face in using various languages and platforms to get the job done. And from time to time I stray from the path and write about what I plan to do, what I actually get around to doing, and what I imagine I am doing.

@omniprof