Changing The Port For Glassfish

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Changing

 the  port  for  Glassfish  


 
If  Glassfish  fails  to  start,  then  you  may  have  a  port  conflict.  Check  the  NetBeans  
“Glassfish  Server”  tab  and  look  for  the  error  “Address  already  in  use..”  If  that  is  
the  problem,  then  follow  the  following  steps  to  change  the  Glassfish  ports:  
 
1. If  the  NetBeans  does  not  have  any  previous  project,  create  a  project  by  
clicking  File  à  New  Project  à  Java  Web  à  Web  Application.  Accept  all  
defaults.  
2. Click  on  the  “Services”  tab  at  the  top  left  of  your  NetBeans  software.    
3. Expand  the  server  link  to  find  Glassfish  Server  
4. Right  click  on  the  server  and  click  “properties”  
5. The  installation  location  is  given  in  “common”  (selected  by  default)”  tab  
6. Navigate  to  the  “Domains  Folder”.  Find  the  domain.xml  location  in  the  
path  specified  in  the  “Domains  Folder”  field.  
7. Open  the  file  in  a  text  editor.  
8. Find  (Cntl  +f)  the  “<network-­‐listeners>”  tag  in  the  domain.xml.  You  
should  look  for  3  tags:    
“<network-­‐listener  protocol="http-­‐listener-­‐1"  port="8080"  name="http-­‐
listener-­‐1"  thread-­‐pool="http-­‐thread-­‐pool"  transport="tcp"></network-­‐
listener>  
                   <network-­‐listener  protocol="http-­‐listener-­‐2"  port="8181"  
name="http-­‐listener-­‐2”  thread-­‐pool="http-­‐thread-­‐pool"  
transport="tcp"></network-­‐listener>  
                   <network-­‐listener  protocol="admin-­‐listener"  port="4848"  
name="admin-­‐listener"  thread-­‐pool="admin-­‐thread-­‐pool"  
transport="tcp"></network-­‐listener>”  
9. Change  the  port  =  parameter  from  8080  to  8090,8181  to  8191  and  4848  
to  4898.  
10. Please  note  that  the  actual  port  numbers  may  vary  dependent  on  whether  
you  have  a  default  installation  or  not.  The  aim  of  the  exercise  is  to  change  
the  port  to  one  that  does  not  conflict  with  installations/processes  already  
running  on  your  system.  
 
 
Testing:  
 
To  test  if  the  port  has  been  changed:  
1. Select  the  “Services”  tab  in  the  left  corner  of  NetBeans.  
2.  Right  click  on  Glassfish  Server  and  selecting  “Start”  
3. Glassfish  server  starts.  Select  the  Glassfish  Server  tab  in  the  output  
window  at  the  left  bottom  of  NetBeans.  
4. Look  for  a  message  similar  to  this:  
“Info:      Created  HTTP  listener  http-­‐listener-­‐1  on  host/port  0.0.0.0:8090”  
5. If  you  get  the  above  message,  GlassFish  is  running  on  port  9090.  
 

You might also like