Configuring a Weblogic server for running Oracle Advanced Management Console

If you are trying to run Weblogic using Docker, having automatic configuration of Weblogic is among the best things ever. Once you have created the scripts for the automatic configuration, that is.
As I started to setup Weblogic for Oracle Advanced Management Console (AMC), I noticed that there were a lack of examples covering the settings needed for AMC. This resulted in needing to piece together different examples that covered what I wanted to achieve. The settings I tried to use came from Oracle’s guide to setting up Weblogic for AMC using the Web GUI, I built the script for Weblogic

I based my Docker image of Oracle’s Docker example, There they set up Weblogic in 2 containers. One for the admin server and another one for the server meant to host AMC. Weblogic Scripting Tool (WLST) is used to set up the Weblogic server. I used WLST online, for more info on WLST see

AMC is packaged into a .ear file that Weblogic runs. I had placed the AMC .ear file at ‘/amc/’ (‘/amc/JavaAMC-2_13.ear’) on the container meant to run AMC. A database is required to run AMC. You can use either an Oracle or MySQL database. For my setup I went with MySQL.

The WLST files from the Oracle examples helps you setup the containers so they are ready to be configured for the specific product that you want to install. To configure Weblogic for AMC I wrote a WLST that automates a large chunk of the manual steps from Oracle’s guide. My WLST file set up the following in Weblogic

  • Set JTA to 300 seconds
  • Deploy JAX-RS 2.0 as a library
  • Create a data source
  • Deploy Oracle Advanced Management Console
import os

# from Oracle example

# Set all variables from values in properties file.
dsName=os.environ.get('MYSQL_DATABASE', 'amc2')
dsUsername=os.environ.get('MYSQL_USER', 'amc2')
dsPassword=os.environ.get('MYSQL_PASSWORD', 'Password!1')
domain=os.environ.get('DOMAIN_NAME', '')

# Have the settings made for the entire cluster

# Have settings made for the specific server

# Connect to the AdminServer
# ==========================

# Deploying JAX-RS 2.0
# Can't deploy while in exclusive edit mode.
print('Deploying JAX-RS 2.0')
progress= deploy(appName='jax-rs',path='/u01/oracle/wlserver/common/deployable-libraries/jax-rs-2.0.war',targets='MS1', libraryModule='true')

# Entering exclusive edit mode

# Java Transaction API, Timeout Seconds value
print('Setting timeout seconds to 300 for domain '+domain)

# Create data source.

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName)
set('JNDINames',jarray.array([String(dsJNDIName)], String))
set('GlobalTransactionsProtocol', java.lang.String('None'))

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName)
set('Password', dsPassword)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCConnectionPoolParams/' + dsName)
cmo.setTestTableName('SQL SELECT 1 FROM DUAL\r\n\r\n')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName)

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/user')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/useUnicode')
cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDriverParams/' + dsName + '/Properties/' + dsName + '/Properties/characterEncoding')

cd('/JDBCSystemResources/' + dsName + '/JDBCResource/' + dsName + '/JDBCDataSourceParams/' + dsName)

cd('/SystemResources/' + dsName)
set('Targets',jarray.array([ObjectName('com.bea:Name=' + dsTargetName + ',Type=' + dsTargetType)], ObjectName))

# Saving and exiting exclusive edit mode

# Deploying Oracle Advanced Management Console
print('Deploying Oracle Advanced Management Console')
progress= deploy(appName='AMC',path='/amc/JavaAMC-2_13.ear',targets='MS1')

# Exit
# ====

The function os.environ.get(‘ENVIRONMENT_VARIABLE_NAME’, ‘DEFAULT_VALUE’) gets the value from an environment variable with name matching the first parameter if it’s set. Otherwise it will use the second parameter as default value.

The variable ‘dsJNDIName’ should not be changed if you plan to use MySQL.
‘dsURL’ & ‘domain’ needs to be updated with values for your setup.

The WLST will configure the Weblogic server and deploy AMC, but it won’t configure the settings inside of AMC. This is something you will have to do manually or research further into on your own. Hopefully this will push your AMC deployment further towards automation.

Leave a Reply