Home
Blog
Training
Course Schedule
Courses Offered
Corporate Training
Video Courses
Resources
Projects
Programs
Video Tutorials
My Favourites
Exam
Books
Books Read
Books Written
Testimonials
Feedback
FAQs
About
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
8080
.
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
Expand
Servers
node and select
GlassFish Server 4.1
Right click and select
Properties
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
8080
. So we need to change that to some other non-conflicting port.
The directory of our interest is directory shown on the right of
Domains Folder
. In my system it is
C:\Users\Srikanth Pragada\AppData\Roaming\NetBeans\8.0.2\config\GF_4.1
File
domain.xml
is where port number of GlassFish is stored. It is in present in
domain1\config
folder, which is in Domains Folder shown above. So, the full path in my system is
C:\Users\Srikanth Pragada\AppData\Roaming\NetBeans\8.0.2\config\GF_4.1\domain1\config\domain.xml
.
Start any text editor such as
NotePad
with Administrator privileges. For this, select editor, right click and select
Run as administrator
option to invoke editor with administrator privileges.
Open
domain.xml
file from the location mentioned in previous steps
Search for
8080
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.
Save
domain.xml
. 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:
Go to
GlassFish Server 4.1
in
Servers
node. Invoke popup menu and select
Start
option to start it. It should start without any issue.