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.