Changing the port that WebLogic listens on (using WLST)

Occasionally I need to change the port that my WebLogic AdminServer is listening on, without actually starting up the server.  Usually this is because I have just created a new domain, and I forgot to change the port in the Domain Configuration Wizard (oops!), and now I can’t start the server up because there is already another one using that port.

One way to get around this is to use the WebLogic Scripting Tool (WLST) to change the listening port.

Start WLST by running:


When you start up WLST, it scans all of the JAR files on its classpath, so it can take a few moments to start up.

The commands below are used to navigate to and change the listening port setting, in this case to 7777.

wls:/offline> readDomain ('/home/mark/Oracle/Middleware/user_projects/domains/base_domain')
wls:/offline/base_domain> cd ('Server')
wls:/offline/base_domain/Server> ls ()
drw- AdminServer
wls:/offline/base_domain/Server> cd ('AdminServer')
wls:/offline/base_domain/Server/AdminServer> ls ()
-rw- ListenPort 7001
wls:/offline/base_domain/Server/AdminServer> set ('ListenPort',7777)
wls:/offline/base_domain/Server/AdminServer> updateDomain ()
wls:/offline/base_domain/Server/AdminServer> exit ()

You can now start up your AdminServer and it will be listening on port 7777.

This process actually just updates the config.xml in the domain’s config directory.  It adds a <listenPort>7777</listenPort> entry in the AdminServer configuration.  Take a look at the file before and after to see what it does.

You can, of course, just go ahead edit the file too.  That is certainly faster, but not quite as instructive!  In WLST using the ls (list) command, you can see all of the other available settings.  Many of these are not in the config.xml file (as they are defaults).  Looking around in WLST can help you discover a lot of the options that are available for configuration.

About Mark Nelson

Mark Nelson is a Developer Evangelist at Oracle, focusing on microservices and messaging. Before this role, Mark was an Architect in the Enterprise Cloud-Native Java Team, the Verrazzano Enterprise Container Platform project, worked on Wercker, WebLogic and was a senior member of the A-Team since 2010, and worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994.
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s