Changing Default GlassFish v3 Prelude Port Numbers 4848, 8080, and 8181

When you create courses, you sometimes do crazy things like installing multiple GlassFish domain administration servers (DAS) in a single host.

When you install GlassFish, it gives you default port numbers of of 4848 (for administration), 8080 (for the HTTP listener), and 8181 (for the HTTPS listener). But what do you do if you want to change them?

I got a few ideas googling "asadmin port number" and the like but couldn't really find a good example. So, I figured out how you do it and thought I would post an example in case anyone finds themselves in the same predicament as I did today.

Here are some examples that work in GlassFish v3 Prelude:

  1. To change the HTTP port to 10080:

    asadmin set server.http-service.http-listener.http-listener-1.port=10080

  2. To change the HTTPS port to 10443:

    asadmin set server.http-service.http-listener.http-listener-2.port=10443

  3. To change the administration server port to 14848:

    asadmin set server.http-service.http-listener.admin-listener.port=14848

It's handy to know you can grep for server properties in GlassFish v3 Prelude as follows:

asadmin get server | grep listener

shows all the properties with the text "listener" in them.

In GlassFish v3 Prelude, you can set port numbers for administration and the HTTP listener in the installer - but not for the HTTPS listener. You might find yourself needing to explicitly specify the administration port in your asadmin command. For example:

asadmin set --port 14848 server.http-service.http-listener.http-listener-2.port=10443

For GlassFish v2, use the asadmin get command as described here.

Hope this is helpful to someone.


This is really useful information. I am doing some crazy stuff you have mentioned above by adding multiple domains on a single host for prototype/research purpose and your post truly come out very handy.

I have installed GlassFish v3 (build 74.2) on windows. There is a small change to object hierarchy which I would like to add/to mention to your life saving thoughtful blog post. This small change is applied to dotted property for http listener. Instead of keeping it as server properties, glassfish has moved it under network-config which is below server and rest of the child hierarchy remains the same.

Below is a sample of command to "get" all network configuration, http port and protocol etc.

C:\\Sun\\glassfishv3\\bin>asadmin.bat --port 15050 get\*

To change HTTP port, I have used "set" as mentioned by your blogpost. The sample is as below:

C:\\Sun\\glassfishv3\\bin>asadmin.bat --port 15050 set

Thanks...and hope to see more cool tips like this from you...

Posted by Phoenix2life on May 18, 2010 at 02:02 AM PDT #

I came to the need to changing Glassfish ports as in my company for some policy the port 8181 is already in use but I still want to use the Netbeans/Glassfish combo.

However using asadmin as you describe seems to require the server already running. Whenever I start it up it immediately goes down saying the port is already in use. So I am not able to make use of the port change through asadmin.

Posted by Hiran Chaudhuri on May 19, 2010 at 03:48 AM PDT #

i really thank you so much Mr for your helping and you kindness i have just been this problem but now i solved it with your helpging thank you so much(\^_\^)

Posted by Forgiveness on June 29, 2010 at 05:06 AM PDT #

It's also posible to change the port directly in configuration file:


Just change the following properties:

<network-listener port="8093" ... />
<network-listener port="8181" ... />
<network-listener port="4848" ... />


Posted by Rodmar Conde on August 02, 2010 at 07:16 AM PDT #

previously i had a "glassfish3 start fail" error
i solved that by following changes in domain.xml file.

<network-listener port="8093" ... />
<network-listener port="8181" ... />
<network-listener port="4848" ... />

Now i m able to start the browser when i run my web application.

but in the browser i have a error message like "HTTP 400 - Bad Request"

how can i overcome that ?

Posted by gaurang patel on August 11, 2010 at 01:46 PM PDT #

It seems to be about your application. Check the glassfish log for any clues.

C:\\Archivos de programa\\glassfish-3.0.1\\glassfish\\domains\\domain1\\logs

Posted by Rodmar Conde on August 12, 2010 at 12:57 AM PDT #

how to open the existing webbased projects in netbean6.91 using oracle 9i and how to debug and run

Posted by farhan basha on September 10, 2010 at 02:59 AM PDT #

Hi ,

In my case the difficulty is that 8080 (default http port) is already used by the Oracle XE Database running on my machine. So I am not able to start Glassfish and this not able to run the above commands

asadmin set ...

Any work-around for this ?.



Posted by Joseph George on January 29, 2011 at 11:14 PM PST #

I have the same problem..
my oracle xe is listening ob 8080
how to change glassfish listener to other port number

Posted by peter on February 03, 2011 at 10:19 PM PST #

try changing the ports in the domain.xml in the config folder of your glassfish domain. - works for me!

can anyone tell me how to make the admin console use the same http-listener as the user applications deployed in your domain? I dont want to user the 4848 port. Instead I want to access my apps through 8080 and the admin-console through 8080 too.

Posted by Joe Carco on February 10, 2011 at 10:39 PM PST #

I changed Glassfish port number successfully.
and working properly...
But one problem, if we are running the web application, then by default browser using 8080 port, then i'm editing changed port number(eg:1234) in browser....

Any solution for browser take by defalut 1234 port num.......

Posted by Manohar on March 01, 2011 at 08:06 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed



« February 2017