How To Change Port Number Of GlassFish Server 4.1
In this blog I would show you how to change port number of GlassFish Server 4.1 that is installed along with NetBeans 8.0.2.
This procedure is applicable to new versions of GlassFish Server.
In case you are using older versions of GlassFish, please refer to my blog on
How To Change Port Number Of GlassFish
Why to change port number?
If GlassFish Server and Oracle Database are installed in the same system, it results in port conflict as both of them use port
So, we have to change port number of GlassFish server as port 8080 is already occupied by Oracle at the time of system start up.
Typically, when you try to run GlassFish Server 4.1 from NetBeans, you get the following error.
Steps to change port number
Here are the steps to change port number of GlassFish Server so that we can run GlassFish at a different port number from Oracle to avoid the port conflict.
First we need to find out the folder where GlassFish is installed
Select Services window by using
Window -> Services
in NetBeans IDE 8.0.2
node and select
GlassFish Server 4.1
Right click and select
option from popup menu. You see the following window, which provides folders where GlassFish is installed and also port numbers related to it.
You see HTTP Port is set to
. So we need to change that to some other non-conflicting port.
The directory of our interest is directory shown on the right of
. In my system it is
is where port number of GlassFish is stored. It is in present in
folder, which is in Domains Folder shown above. So, the full path in my system is
Start any text editor such as
with Administrator privileges. For this, select editor, right click and select
Run as administrator
option to invoke editor with administrator privileges.
file from the location mentioned in previous steps
and change it to some other port number that doesn't conflict with other port numbers. I generally change it to 8888. See the lines in editor below.
. If you start editor without adminstrator privileges, you get an error while saving. In this case, start editor using Run as administrator and redo editing.
Now go back to NetBeans and see the properties of GlassFish 4.1. It should be as shown below:
GlassFish Server 4.1
node. Invoke popup menu and select
option to start it. It should start without any issue.