While starting a managed server in weblogic, we start with below command.
1
<domain_home>/bin/startManagedWebLogic.sh soa_server1 t3://localhost:7001
This command will prompt to manually enter the username and password for the AdminServer. There are two ways of preventing that and here I am going to talk about it.
Option 1: Setting the java options for username and password.
Set below java option on your terminal before starting the managed server.
export JAVA_OPTIONS=”-Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic1″
After setting this, when the WLS Managed server startup kicks off, it will pick up the username and password from above properties and wouldn’t ask for manual entry of Adminserver username or password.
Option 2: Setting up boot.properties
While starting weblogic server [including AdminServer], it will check for a file called boot.properties in <domain_home>/servers/AdminServer/security. This file can hold the property values for username and password and if the right values are present, WLS isn’t going to prompt for manual authentication. This file will be present by default for AdminServer and that’s why while starting AdminServer, it doesn’t prompt for username and password. To test, remove this file from servers/AdminServer/security and start your AdminServer – you will see that even AdminServer start up prompts you for entering username and password manually.
Enriching this concept for managed server, create a file boot.properties in the managed server folder.
Eg:
mkdir <domain_home>/servers/soa_server1/security
Create a new file called boot.properties and enter below property values.
username=weblogic
password=weblogic
Now save this file and start the managed server as usual.
<domain_home>/bin/startManagedWebLogic.sh soa_server1 t3://localhost:7001
This time also, it wouldn’t prompt to enter the username and password manually.
NOTE that when the server is started for the first time, it will automatically encrypt BOTH username and password stored on this file.