FMW - boot.properties
In this post, I am writing to create a boot properties in Linux/Unix and Windows.
Just a recap and for the readers not used to play with Oracle Fusion Middleware / WebLogic, the general steps to build an Oracle Fusion Middleware available are.
- Chose the version – and check the certification matrix again your business requirements
- Download the software : Oracle Fusion Middleware + Java
- Install the software
- Create Domain
Domain creation, when the servers start the startWeblogic.* scripts in the process in an iterative mode, will ask the WebLogic credentials.
The way to avoid that is to provide a file called boot.properties , the location for the file is inside the domain home/servers/<servername>/security ( this folder needs to be created ) .
eg.
Linux/Unix: ${DOMAIN_HOME}/servers/AdminServer/security/boot.properties
Windows : %domain_home%\servers\AdminServer\security\boot.properties
It means that after the 4 step – the next action will be create that boot.properties file.
Note: In the Windows section, it has the example also for FORMS and REPORTS servers.
Linux/Unix
I will start to export the path to the domain folder.
$ export DOMAIN_HOME=<path_to_domain_folder>
Then Run the bellow script.
if [ -f "${DOMAIN_HOME}/servers/AdminServer/security/boot.properties" ]; then
mv ${DOMAIN_HOME}/servers/AdminServer/security/boot.properties $DOMAIN_HOME/servers/AdminServer/security/boot.properties.backup
echo "username=weblogic" > $DOMAIN_HOME/servers/AdminServer/security/boot.properties
echo "password=Weblogic01" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties
cat $DOMAIN_HOME/servers/AdminServer/security/boot.properties
else
mkdir -p $DOMAIN_HOME/servers/AdminServer/security
echo "username=weblogic" > $DOMAIN_HOME/servers/AdminServer/security/boot.properties
echo "password=Weblogic01" >> $DOMAIN_HOME/servers/AdminServer/security/boot.properties
cat $DOMAIN_HOME/servers/AdminServer/security/boot.properties
fi
Windows
I'm sharing next how to do this in Windows, using PowerShell.
Here I will elaborate more as, these were some of my first scripts in *.ps1.
I took the oportunity to do a similar thing in a diferent way , play with variables declaration/concatenation and load them into another *.ps1 script.
So I created a file with some variable MyVariables.ps1
#Oracle Fusion
$fmw_env='dev'
$fmw_OracleBase='D:\Oracle\'
$fmw_OracleHome=$fmw_OracleBase + '\' + 'middleware_' + $fmw_env
#domain info
$domain_name="my_domain"
$domain_home=$fmw_OracleHome+"\user_projects\domains\"+$domain_name
$domain_admin="weblogic"
$domain_passw="Weblogic01"
#boot.properties file
$adminBootProperties=$domain_home+'\servers\AdminServer\security\boot.properties'
$formsBootProperties=$domain_home+'\servers\WLS_FORMS\security\boot.properties'
$reportsBootProperties=$domain_home+'\servers\WLS_REPORTS\security\boot.properties'
then ,the script for execute the job. Notice the usage of the special character (`n )in the echo
. .\MyVariables.ps1
if(![ System.IO.File ]::Exists($adminBootProperties)){
New-Item -ItemType File -Force -path $adminBootProperties
echo "username=$domain_admin`npassword=$domain_passw" | Set-Content $adminBootProperties
}
if(![System.IO.File]::Exists($formsBootProperties)){
New-Item -ItemType File -Force -path $formsBootProperties
echo "username=$domain_admin`npassword=$domain_passw" | Set-Content $formsBootProperties
}
if(![System.IO.File]::Exists($reportsBootProperties)){
New-Item -ItemType File -Force -path $reportsBootProperties
echo "username=$domain_admin`npassword=$domain_passw" | Set-Content $reportsBootProperties
}

Find and Print Contents
After start the servers this file will be encrypted
Get-Childitem –Path $domain_home -Recurse -Include *boot.* | cat

Thank you for reading, hope this post was helpful.
Rogerio
Comments