Srikanth Technologies

How To Change Port Number Of GlassFish

If GlassFish and Oracle Database are installed in the same system, it results in port conflict as both of them use port 8080.

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.

Post Your Comment

Enter the code given in the above image :
Enter Your Name :
Enter Your Email Address :
Enter Your Comment :


Posted By chandan On 19-Oct-10 11:18:14 AM

Actually to work with JAVA EE6.0, i stopped my oracle and then used the port no(8080) for Glass fish, but now i came to know how to change the port no. of glassfish. I will be no more use the same port no. for both.
Thank you Sir

Posted By renu On 11-Nov-10 12:44:50 AM

thanks a lot to u........I was really tensed for these three days because of the error caused by this reason.Your blog really helped me out for this, now i m able to run my glassfish server without any error and can complete my project on time. really thanks to u.

Posted By sunil On 30-Jun-11 03:55:37 PM


Posted By dewakar On 23-Oct-11 07:05:28 PM

thanks i changed the port number in that domain.xml

Posted By appu On 23-Oct-11 10:32:51 PM


Posted By nithin On 09-Dec-11 09:07:13 PM

Thank U...
I searched almost a week 4 solution 2 this problem..
Thank U so much..:)

Posted By M Shankar Rao On 24-Dec-11 04:17:20 PM

Thanks for the steps regarding changing the port number of GlassFish Server.

Posted By Rohit On 23-Jan-12 09:25:15 AM

This worked. Thanks a lot.

Posted By Hemavathy On 04-Feb-12 11:20:39 AM

This helped me..Thank u very much..

Posted By sawes On 27-Feb-12 10:04:18 PM

thanks a lot

Posted By Mary On 15-Mar-12 02:56:08 PM

code given in this pages is very useful to me

Posted By Sarnendu Mukherjee On 19-Mar-12 08:20:54 PM

Awesome.. Thank you so very much.. Thanks a lot..
I was searching just this proper ans for a long time.. Thanks again.. :) :D

Posted By Amit Chauhan On 08-Apr-12 11:18:38 AM

i m really very very thankful to you. Thanks for provide such a great help.

Posted By herambha kumar On 14-Apr-12 04:39:37 PM


Posted By Aster On 06-May-12 08:11:59 PM

Thanks! This "how to" helped me a lot. :)

Posted By veer On 25-May-12 10:24:07 AM

thanks... it was very useful :)

Posted By Aarti On 29-May-12 09:59:53 AM

Thanks a lot. I was struggling with Glassfish for more than 1 week and you made it in less than 5 mins. :)
Thanks a lot.
Verrrry useful tutorial.

Posted By james On 23-Jun-12 03:37:15 PM

thank you so much

Posted By Bhagyesh Solanki On 23-Jun-12 08:37:57 PM

Thank you,Sir
Very nice blogs.
that realy helpful to us for connection of jdbc.

Posted By ayerer On 06-Jul-12 01:54:37 AM

Thank you so much - so many people seem to have had this problem, as I did, but I only found a solution on your post!

Posted By vinod On 22-Jul-12 09:38:42 PM

bang on target. does what it claims and precise without too much hype


Posted By Vijay On 11-Aug-12 01:16:31 AM

Thanks a lot

Posted By Praveen On 18-Aug-12 03:25:37 PM

Thanks A lot Sir...!!
It really works.

Posted By kumar On 20-Aug-12 07:42:29 PM

thanks for giving more important information and another techniques about java,.net,android thanks once again;

Posted By Ashish On 18-Oct-12 03:19:19 PM

Thanks a Lot :-)

Posted By mss On 29-Nov-12 03:01:22 PM

thank you for ur post

Posted By londonbridgebox On 30-Dec-12 10:27:37 AM

Thank you :)

Posted By nalu On 03-Jan-13 05:26:47 AM

Thanks Heaps!

Posted By Lahiru On 18-Jan-13 06:04:17 AM

Thank you for your co-operation, I fixed my issue in glass fish 3.1.2 port error due this post............. Thank you once again

Posted By Ali On 19-Jan-13 12:37:55 PM


Posted By satya On 01-Feb-13 01:24:03 AM

Thanks a lot my friend.
It was really useful.


Posted By Subrata On 22-Mar-13 01:56:58 PM

It worked thank you sir...

Posted By Serg On 17-Jun-13 11:41:50 PM

That's what we've all been wainitg for! Great posting!

Posted By naseer khan On 20-Aug-13 05:25:35 PM

Thank you very much for providing us with such a fantastic solution.
i was also getting the same problem

Posted By CC On 28-Aug-13 07:33:56 AM

Thanks a lot!
I had been struggling for hours until I saw your solution.

Posted By Raj Arvind On 23-Oct-13 10:11:06 PM

what is the installation location to be given while reinstalling glass fish.. pls tell.

Posted By zia khalid On 04-Nov-13 01:12:19 PM

Thanks a lot ,i changed the port number and glassfish is running

Posted By Hemanth Malla On 06-Nov-13 11:52:00 PM

Thanku for the info sir...

Posted By Hemanth Malla On 06-Nov-13 11:54:15 PM

but sir.. may i know the reason behind why both the glassfish and oracle tries to run on same port number 8080 ?

Posted By Damian On 20-Nov-13 04:32:16 PM

Thanks a lot. This helped with my class project

Posted By sachin On 07-Dec-13 08:59:18 PM

thanks a lot to you sir you are really genious..

Posted By nagarjun On 12-Dec-13 04:22:38 PM

i successfully changed and removed the server from the net beans. and i try to add glassfish server it is asking target,username and password. i enterd username as "admin" and password is i before changed "123" but in the target field what i have to give.
Thank you

Posted By naoufal On 26-Feb-14 11:39:41 PM

this helped me , thanks a lot !

Posted By Prabhu Nandan Kumar On 05-Mar-14 08:17:02 PM

This work for me :) Thanks ....!!!

Posted By DM On 13-Mar-14 11:27:32 AM

Thank u very much.Your information was useful to me.

Posted By Nagaraju On 23-Mar-14 12:01:58 AM

thank you. it helps me a lot.

Posted By santha kumar On 26-Mar-14 06:38:29 PM

i installed mysql,oracle xe,tomcat and glassfish4. i have also server starting problem in glassfish. then i changed my glassfish port no from 8080 to 8090 but it is not working.please help me

Posted By Prashant On 12-May-14 12:15:12 PM

Thanks it very useful.....

Posted By Jaskirat Singh On 21-May-14 10:46:12 AM

simple , true and great ....all the steps are necessary and even work for glassfish version 4

Posted By sharma On 06-Jun-14 01:34:01 AM

thank u so much

Posted By Rajitha On 23-Jul-14 10:33:09 PM 's working both servers are running now in same time...this was really helpful to me.

Posted By sachin On 16-Aug-14 10:01:25 AM

thanks a lot sir..

Posted By Husain On 20-Nov-14 01:22:24 PM


Posted By KVYAS On 24-Jan-15 10:00:43 AM

I am still getting the same problem after changing the port to 9999: I am using Windows 8 with NB 8.0.2 and GF 4.1. I have stopped all the Oracle Corp-related services in msconfig on startup. I need your help. Thank you.

Posted By Shilpi On 02-Feb-15 09:47:16 AM

Thanks a lot It was really helpful for me as my Wamp server was running in the default port

Posted By Baby On 18-Mar-15 02:18:26 AM

Thanks a lot..!!! It really helped..!!

Posted By kaushlendra On 01-Apr-15 07:05:18 PM

At first very very thank u sir becoz intialy I am very tense with this problem but after as i viewed your blog it all work, once again thank u very much

Posted By Ragita On 07-Apr-15 05:44:05 PM

Excellent Help!

Posted By ganesh On 09-Jul-15 09:43:47 AM


I follwed the instructions as given by you.Infact there are 2 ports containing 1)8080
2)28080. I changed the first port specified 8080 to 9999. Rest of the instructurions as stipulaed by you. Still problem persists. can you help me

with regards,

Posted By anshu On 17-Aug-15 05:28:45 PM

I am not able to change the port number. Every time i try to save the edited version of the domain.xml document,it gives me the message "Access denied".
In order to avoid this, i also tried removing the glassfish server from netbeans and then editing the domain.xml document but it was in vain. Moreover, it now asks me to download glassfish server again in order to add it as a server to netbeans.
Kindly suggesst something.

Posted By we patel On 23-Aug-15 11:40:47 PM

How To Change Port Number Of GlassFish IN UBUNTU 14.04 64BIT

Posted By vikas jaiswal On 27-Sep-15 03:02:54 PM

thanks a ton...
now its working...

Posted By krishnan On 14-Oct-15 06:01:11 PM

good information

Posted By Ramesh On 05-Nov-15 12:11:42 PM

Thanku sir, i proudly say i am one of your student.......

Posted By ThunderFlash On 08-Dec-15 07:56:06 PM

Thank you for this article :-) In my case Oracle XE used the same port (8080) as GlassFish. Now they use different ports.

Posted By Aarif On 18-Dec-15 01:57:38 PM

I am not able to change the port number. Every time i try to save the edited version of the domain.xml document,it gives me the message "Access denied".

Posted By celina On 08-Jan-16 01:04:12 PM

its working....thank you so much

Posted By Mala On 20-Jan-16 12:36:09 PM

Thank you so much for your idea

Posted By Sanal On 30-Mar-16 11:00:55 AM

Nice info., Yes it works! Thanks a lot!


Posted By Staunch On 01-Apr-16 08:29:44 PM

Hello sir i dnt kno how to thank you, you have saved my ass from this shit. may u live long and keep helping out fams lyk u alwaes do. i say thank you again

Posted By Raji On 07-May-16 01:17:20 AM

Thank you so much...sir..

Posted By Alkaram Ansari On 01-Jul-16 08:31:32 PM

thanx a lot...

Posted By reema On 22-Dec-16 03:30:01 PM

I Have tried various ports but still it is giving me the same error again glassfish server server cannot start port occupied.
Please Help

Posted By luis On 19-May-17 10:13:54 PM

Thanks, help me a lot.

Posted By Sandra On 31-Jan-18 05:44:21 PM

Thank you! Thank you! Thank you!