Changing Glassfish Port Number on Netbeans

I’ve been running homestead for a while now and I made some changes to the configuration and used port 8080 for some POCs.  Recently, I’ve been playing with J2EE and Glassfish.  While building the code I got an error

Java EE run error “ no protocol: ${client.url}”

Most likely this is a port conflict.  To change Glassfish’s port number on building the project, I found a very good tutorial to modify it on netbeans.
Here is the procedure to change port number of GlassFish so that you can run GlassFish at a different port number from Oracle to avoid the port conflict.

  1. Find out the folder where GlassFish is installed.If you installed GlassFish along with NetBeans, you can find out the folder where GlassFish is installed by using the following procedure.
    • Select Services window by using Window -> Services in NetBeans IDE
    • Expand Servers node and select GlassFish Domain
    • Right click and select Properties option from popup menu
    • On the right of Domains Folder you can see the folder where GlassFish is installed. For example : C:\netbeans6.8\glassfish-v3\glassfish\domains You can also see the other details regarding Glassfish such as port number, in the same window.
  2. Go to the folder where Glassfish in installed.
  3. Go into config folder which is as follows: c:\netbeans6.8\glassfish-3\glassfish\domains\domain1\config
  4. Open domain.xml using any text editor.
  5. Look for 8080 and change it to some other port number that doesn’t conflict with other port numbers. I generally change it to 9999.
  6. Save domain.xml.
  7. Now you need to remove GlassFish from NetBeans and add it again so that NetBeans IDE understands the new port number. For this do the following:
    • In Servers window of NetBeans, remove GlassFish by using RemoveServer button after selecting GlassFish server
    • Click on AddServer and select GlassFish V2 or GlassFish V3 and click on Next
    • Select the Installation Location of GlassFish and click on Next
    • Accept defaults and click on Finish
  8. Restart GlassFish, if it was already running.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s