Thursday, February 12, 2015

Generating your WLS-domain to a WLST-script through configToScript

If you want to generate a WLST-script from your domain, you can use the configToScript WLST-command.
This command has 4 optional parameters:
  • configPath : your domain directory; if null, your current directory will be taken
  • pyPath : the directory where the script files will be generated
  • overwrite : if the script already exists, it will be overwritten
  • propertiesFile : path to the properties file of the script
  • createDeploymentScript : boolean that indicates if a script will be generated to redeploy the applications in the domain (default value = false)
Start WLST through the wlst.sh script.

wls:/offline> configToScript('/opt/oracle/Oracle/Middleware/user_projects/domains/base_domain/','/home/oracle/wlst_scripts','true','/home/oracle/wlst_scripts/base_domain.properties','true')
configToScript is loading configuration from /opt/oracle/Oracle/Middleware/user_projects/domains/base_domain/config/config.xml ...
Completed configuration load, now converting resources to wlst script...
Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Creating new key...
Using existing user key file...
Using existing user key file...
Using existing user key file...
Using existing user key file...
Using existing user key file...
Using existing user key file...
Using existing user key file...
Using existing user key file...
configToScript completed successfully The WLST script is written to /home/oracle/wlst_scripts/config.py and the properties file associated with this script is written to /home/oracle/wlst_scripts/base_domain.properties
WLST found encrypted passwords in the domain configuration. 
These passwords are stored encrypted in /home/oracle/wlst_scripts/c2sConfigbase_domain 
and /home/oracle/wlst_scripts/c2sSecretbase_domain. WLST will use these password values 
while the script is run.
wls:/offline> exit()


Exiting WebLogic Scripting Tool.


After this, you can verify the created files:

[oracle@wls12c wlst_scripts]$ pwd
/home/oracle/wlst_scripts
[oracle@wls12c wlst_scripts]$ ls
base_domain.properties  c2sSecretbase_domain  deploy.py
c2sConfigbase_domain    config.py

Optionally, open the base_domain.properties file and modify the value of the domainDir parameter.

Now, we will recreate the domain with the scripts.
Therefore, we first backup and then delete the WLS-domain directory.  Also, it is a good advice to backup your application sources.
Then, we can execute the config.py script through WLST.

Normally, during the first run, you will encounter this error:
Exception in thread "Main Thread" java.lang.AssertionError: JAX-WS 2.2 API is required, but an older version was found in the JDK.

To solve this, go to the $JAVA_HOME/jre/lib directory and create the "endorsed" directory, if not exists.
Copy the jars in the $WL_HOME/endorsed directory to this new directory.

Now try again to run the Jython script in WLST.  If successful, you can start up your environment.

I noticed afterwards that my application was not deployed, so I redeployed it with WLST.

No comments:

Post a Comment