Creating JMS server, JMS module, JMS Connection Factory and JMS Queue through WLST

In this post we will see how to Creating JMS server, JMS module, JMS Connection Factory and JMS Queue using wlst scripts.

Create a directory in your system and create a properties file with below information and name it as ““.

# 1 – ENTER Server Connection details
server.url = t3://localhost:7001
username = weblogic
password = welcome1

# 2 – ENTER JMSServer details = TEST_JMSServer = TEST_JDBCStore = AdminServer

# 3 – ENTER  SystemModule Details = TEST_JMSModule = AdminServer

# 4 – ENTER  ConnectionFactory Details = TEST_ConnectionFactory = jms/TEST_CF

# 5 – ENTER  Unit Of Order Details
unit.of.order.value = 1

# 6 – ENTER  SubDeployment & Queue Details = Sub_TEST_Queue = TEST_Queue = jms/TEST_Q

Now in the same directory create a new file for JMS script with below script and name it as “

from import FileInputStream
import java.lang
import os
import string

propInputStream = FileInputStream(“”)
configProps = Properties()

# 1 – Connecting details
serverUrl = configProps.get(“server.url”)
Username = configProps.get(“username”)
Password = configProps.get(“password”)

# 2 – JMSServer details
jmsServerName = configProps.get(“”)
storeName = configProps.get(“”)
tragatedJMSServerName = configProps.get(“”)

# 3 – SystemModule Details
systemModuleName = configProps.get(“”)
tragatedSystemModuleName = configProps.get(“”)

# 4 – ConnectionFactory Details
connectionFactoryName = configProps.get(“”)
ConnectionFactoryJNDIName = configProps.get(“”)

# 5 – Unit Of Order Details
unitOfOrderValue = configProps.get(“unit.of.order.value”)

# 6 – SubDeployment & Queue Details
queueSubDeploymentName = configProps.get(“”)
queueName = configProps.get(“”)
queueJNDIName = configProps.get(“”)


# 1 – Connecting to the Destination


# 2 – JMSServer details
print “================== JMSSever ===================”
print “Created a JMSServer !!”
print “PersistentStore has been set for the JMSServer !!”
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=’+tragatedJMSServerName+’,Type=Server’)], ObjectName))
print “Targeted the JMSServer !!”
print “”

# 3 – SystemModule Details
print “================== SystemModule ===================”
print “Created a SystemModule !!”
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=’+tragatedSystemModuleName+’,Type=Server’)], ObjectName))
print “Targeted the SystemModule !!”
print “”

# 4 – ConnectionFactory Details
print “================== ConnectionFactory ===================”
print “Created a ConnectionFactory !!”
print “Targeted the ConnectionFactory !!”
print “”

# 5 – Unit Of Order Details
print “================== Unit Of Order ===================”
print “Changed Unit Of Order !!”
print “”

# 6 – SubDeployment & Queue Details
print “================== SubDeployment & Queue ===================”
print “Created a SubDeployment for Queue !!”
print “Created a Queue !!”
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=’+jmsServerName+’,Type=JMSServer’)], ObjectName))
print “Targeted the Queue to the created subdeployment !!”
print “”

cmd = “rm -f wlst.log”

To use this script, we need to edit the properties file at the top of the program.

Now place both the properties and python file  in the server location(cd /your/fmwhome/wlserver/server/bin/)

Set the domain environment by running the below command.

cd /your/fmwhome/wlserver/server/bin/> setDomainEnv.cmd

Now run the python script with below command.

/your/fmwhome/wlserver/server/bin/>  java weblogic.WLST


High availability setup for Oracle MFT

In this post we will post see how to configure MFT for high availability.

If you wont setup the high availability properties in mft console in a cluster environment then you will face the issues with file polling.

For high availability we have to set the below properties.

Control Directory–> is the directory path which MFT File/FTP adapters require to
handle HA use cases. This field is required if the MFT is running in HA
environment. You must set it to a shared location if multiple Oracle WebLogic
Server instances run in a cluster, for example $DOMAIN_HOME/mft/control_di.

Inbound Datasource –>is the inbound data source of MFT where the schemas
corresponding to high availability are precreated. This field is required if the
Control Directory is not provided. The default, established outside of Oracle
Managed File Transfer, is jdbc/MFTDataSource.

Outbound Datasource –> is the outbound data source of MFT where the schemas
corresponding to high availability are precreated. This field is required if the
Control Directory is not provided. The default, established outside of Oracle
Managed File Transfer, is jdbc/MFTDataSource.

Create a control directory in your domain home and name it like “control_di”.

Login to mftconsole and go to administration –> Server properties

In High availability properties provide the newly created control directory location and data source jndi name in both inbound and outbound datasource.


Configure Custom Oracle MFT Notifications in SOA Suite

Usually in our projects we get the requirement for sending the notifications for all success and failures . But in my MFT we don’t have direct option or event available to achieve this requirement.

When the transfer is successful user needs to be notified via email so that they can take further action.
User can set filter criteria for file name and file size for which notification needs to be sent.

Follow the below steps for running this sample :

1. Import the transfer( This will automatically add the callout definition to the repository. You can also download the callout definition XML(postTransferNotification.xml), if you manually want to create the callout definition.
2. Download the callout jar (postTransferNotification.jar) and source code (
3. Download the email template (template.eml) (don’t forget to change the email address in the template) file and place it under template location specified in the notification callout associated with the target.
4. Go to MFT Console -> Administration tab -> Server Properties -> General Configuration . Check for the custom callout directory setting and place the jar,xml and eml template in that folder.

Installing Callout with WLST command:-

a. Run WLST using: $ $MW_HOME/mft/common/bin/
b. Connect to MFT server using the below command :
connect(“admin user”, “password”, “t3://localhost:mftport”)
c. listCallouts()
d. createCallouts(‘ $DOMAIN_HOME/mft/callouts/postTransferNotification.xml’)
e. listCallouts()

Login to MFT console :-
5. Deploy the transfer from the MFT console

Go To Design Page and Open the Transfers – >  in target -> Post Process Actions:
Click “add post-processing actions” and you will see a drop down list with newly created callout, select it and click on add to list .

Provide the location of the “Email Template File location” as step 4 .

6. Please make sure that the ums email drivers for the mft server is configured properly.
7. Send the sample file to embedded ftp server in the /mymart.

To Download the files ClickHere

Creating Data source and DB adapter outbound connection pool using WLST

In this post we will see how to create a data source , DB adapter outbound connection pool and redeployment using wlst scripts.

Lets look at the script which creates both DS and DB adapter connection pool and redeployment.

import time

# admin server url
url = ‘t3://localhost:7001’
# username to connect to the admin server
username = ‘weblogic’
# password to connect to the admin server
password = ‘welcome1’
# the name for the EIS
eisName = ‘eis/db/myDS’
# the admin or managed server to target where the DbAdapter is deployed
serverName = ‘AdminServer’
#nmServerName = ‘soa_server1’
# the name for the data source
dsName = ‘myDS’
# the JNDI name for the data source
jndiName = ‘jbdc/myDS’
# the database url for the data source
dbUrl = ‘jdbc:oracle:thin:@localhost:1522:SOAORA’
# the database user
dbUser = ‘soa12c_soainfra’
# the database password
dbPassword = ‘welcome_1’
# the database driver to use
dbDriver = ‘oracle.jdbc.xa.client.OracleXADataSource’
# the host where node manager is running
#nmHost = ‘localhost’
# the port to connect to node manager (5556 is default for plain mode)
#nmPort = ‘5556’
# the user to connect to node manager
#nmUser = ‘weblogic’
# the password to connection to node manager
#nmPassword = ‘welcome1’
# the name of the weblogic domain
domain = ‘soa12c_domain’

# don’t change the below ones
uniqueString = ”
appName = ‘DbAdapter’
moduleOverrideName = appName+’.rar’
moduleDescriptorName = ‘META-INF/weblogic-ra.xml’

# method definitions

def makeDeploymentPlanVariable(wlstPlan, name, value, xpath, origin=’planbased’):

variableAssignment = wlstPlan.createVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
wlstPlan.createVariable(name, value)

print(‘–> was not able to create deployment plan variables successfully’)

def main():

uniqueString = str(int(time.time()))

# Create a JDBC Data Source.

print(‘–> about to connect to weblogic’)
connect(username, password, url)
print(‘–> about to create a data source ‘ + dsName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDataSourceParams/’ + dsName)
set(‘JNDINames’,jarray.array([String(jndiName)], String))
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCDriverParams/’ + dsName)
cd(‘/JDBCSystemResources/’ + dsName + ‘/JDBCResource/’ + dsName + ‘/JDBCConnectionPoolParams/’ + dsName)
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 + ‘/JDBCDataSourceParams/’ + dsName)
cd(‘/JDBCSystemResources/’ + dsName)
set(‘Targets’,jarray.array([ObjectName(‘com.bea:Name=’ + serverName + ‘,Type=Server’)], ObjectName))
print(‘–> activating changes’)
print(‘–> done’)

# update the deployment plan
print(‘–> about to update the deployment plan for the DbAdapter’)
planPath = get(‘/AppDeployments/DbAdapter/PlanPath’)
appPath = get(‘/AppDeployments/DbAdapter/SourcePath’)
print(‘–> Using plan ‘ + planPath)
plan = loadApplication(appPath, planPath)
print(‘–> adding variables to plan’)
makeDeploymentPlanVariable(plan, ‘ConnectionInstance_eis/DB/’ + dsName + ‘_JNDIName_’ + uniqueString, eisName, ‘/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface=”javax.resource.cci.ConnectionFactory”]/connection-instance/[jndi-name=”‘ + eisName + ‘”]/jndi-name’)
makeDeploymentPlanVariable(plan, ‘ConfigProperty_xADataSourceName_Value_’ + uniqueString, eisName, ‘/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface=”javax.resource.cci.ConnectionFactory”]/connection-instance/[jndi-name=”‘ + eisName + ‘”]/connection-properties/properties/property/[name=”xADataSourceName”]/value’)
print(‘–> saving plan’);
print(‘–> activating changes’)
print(‘–> redeploying the DbAdapter’)
redeploy(appName, planPath, targets=cmo.getTargets());
print(‘–> done’)

print(‘–> something went wrong, bailing out’)
raise SystemExit

# disconnect from the admin server

print(‘–> disconnecting from admin server now’)

# this is the main entry point


To use this script, we need to edit the parameters at the top of the program.

save it somewhere in the server location(cd /your/fmwhome/wlserver/server/bin/) with name like “”

Set the domain environment by running the below command.

cd /your/fmwhome/wlserver/server/bin/> setDomainEnv.cmd

Now run the python script with below command.

/your/fmwhome/wlserver/server/bin/>  java weblogic.WLST

Now if you open your weblogic console you will find both DS and DB adapter configured with above values.


Issue –> when launching the wlst commands you will get the below error.

Error –>,Type=MFT,Application=mft-app

Cause –> The issue occurs when connecting to AdminServer, but MFT is deployed in another managed server

Solution –>

Solution is to this is connect to the mft_server instead, with this connection the MFT specific commands work as expected.

For example,  lets assume the port for AdminServer is 7001 and the port for MFT server is 7003. Connection to the MFT server is: