Monday, March 11, 2013

Creating JMS Adapter connection factory through WLST script in weblogic server

Creating JMS Adapter connection factory through WLST script in weblogic server:

The below WLST script will help us to create the JMS adapter connection factories. Before Executing the script change the details accordingly.

configureJMSAdapterConnection.py

TargetServerName='AdminServer'

soaHome='oracle/Middleware/Oracle_SOA1'

appPathJms=soaHome+'/soa/connectors/JmsAdapter.rar'
appNameJms='JmsAdapter'
moduleOverrideNameJms=appNameJms+'.rar'
JMSJNDIName = 'eis/wls/BAMQueueConnection'
JMSConnectionfactory='jms/BAMMonitoringConnectionfactory'
#Sever Details

moduleDescriptorName='META-INF/weblogic-ra.xml'
planPathJms=soaHome+'/soa/connectors/Plan_JMS.xml'

def createJMSConnectionFactory():

        edit()
        startEdit()
        startApplication(appNameJms)
        myPlanJms=loadApplication(appPathJms, planPathJms)
        makeDeploymentPlanVariable(myPlanJms,'ConnectionInstance_eis/Jms_JNDIName_13102979357209', JMSJNDIName , '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="'+JMSJNDIName+'"]/jndi-name',moduleOverrideNameJms)
        makeDeploymentPlanVariable(myPlanJms, 'ConfigProperty_eis/JMS_JNDIName_ConnectionFactory_Name_13102979357210', JMSConnectionfactory,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="oracle.tip.adapter.jms.IJmsConnectionFactory"]/connection-instance/[jndi-name="'+JMSJNDIName+'"]/connection-properties/properties/property/[name="ConnectionFactoryLocation"]/value',moduleOverrideNameJms)

        myPlanJms.save();
        save();
        cd('/AppDeployments/JmsAdapter/Targets');
        updateApplication(appNameJms, planPathJms);
        activate(block='true');
     
  
def makeDeploymentPlanVariable(wlstPlan, name, value, xpath,overrideName, origin='planbased'):
    wlstPlan.destroyVariable(name)
    wlstPlan.destroyVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment = wlstPlan.createVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment.setXpath(xpath)
    variableAssignment.setOrigin(origin)
    wlstPlan.createVariable(name, value)
    print 'moduleDescriptorName=',moduleDescriptorName


def main():
       adminURL='t3://localhost:9001'
       adminUserName='weblogic'
       adminPassword='welcome1'
       connect(adminUserName, adminPassword, adminURL)
       createJMSConnectionFactory()
       disconnect()
main()

Login to the server, cd to the folder where the script is available and execute the script as shown below.

%MIDDLEWARE_HOME%\wlserver_10.3\common\bin\wlst.cmd configureJMSAdapterConnection.py


1 comment:

  1. Hello,
    I created sample application using JMS Adapter. It is working fine. I have configured JMS modules correctly in weblogic server. It sending jms messages successfully. But, the instance is not generated in the emconsole


    Please provide your suggestions

    Regards,
    Mithun

    ReplyDelete