rss
SOATUBE
Oracle
Custom Search SOABYTE here

Friday, May 24, 2013

WLST script to change Composites properties(adapter.jms.receive.threads/adapter.jms.receive.timeout)

WLST script to change Composites properties(adapter.jms.receive.threads/adapter.jms.receive.timeout)

#domain.properties file referenced in WLST script

#*****************************************************
# Environment details
#*****************************************************
ADMIN_USERNAME = weblogic
ADMIN_PASSWORD = welcome1
ADMIN_URL = t3://localhost:7001

##*****************************************************
## JMS Receive Threads/Timeout Configurations         *
##*****************************************************

CompositeNames = CompositeA,CompositeB,CompositeC,CompositeD,CompositeE,CompositeF,CompositeG,CompositeH

SCAService.CompositeA = SCAServiceNameA
SCAService.CompositeB = SCAServiceNameB
SCAService.CompositeC = SCAServiceNameC
SCAService.CompositeD = SCAServiceNameD
SCAService.CompositeE = SCAServiceNameE
SCAService.CompositeF = SCAServiceNameF
SCAService.CompositeG = SCAServiceNameG
SCAService.CompositeH = SCAServiceNameH

adapter.jms.receive.timeout.CompositeA = 1000
adapter.jms.receive.threads.CompositeA = 1
adapter.jms.receive.timeout.CompositeB = 1000
adapter.jms.receive.threads.CompositeB = 5
adapter.jms.receive.timeout.CompositeC = 1000
adapter.jms.receive.threads.CompositeC = 10
adapter.jms.receive.timeout.CompositeD = 1000
adapter.jms.receive.threads.CompositeD = 10
adapter.jms.receive.timeout.CompositeE = 1000
adapter.jms.receive.threads.CompositeE = 10
adapter.jms.receive.timeout.CompositeF = 1000
adapter.jms.receive.threads.CompositeF = 10
adapter.jms.receive.timeout.CompositeG = 1000
adapter.jms.receive.threads.CompositeG = 5
adapter.jms.receive.timeout.CompositeH = 1000
adapter.jms.receive.threads.CompositeH = 10

########################################################################################
# AIA ConsumerJMSThreadsConfigProperties Automation WLST Script                        #
# @Team Fusion (soabyte@gmail.com)                                                     #
# Restart the servers after running this script.                                       #
#Do not change the description                                                         #
#domain.properties file will have the composite names(comma separated),                #
#SCAServiceNames and adapter.jms.receive.threads/adapter.jms.receive.timeout values    #
#Replace CompositeA with the composite name and SCAServiceNameA with SCA service name  #
#This script can be modified to automate changing other properties                     #
########################################################################################
#Running the script                                                                    #
########################################################################################
#WL_HOME\server\bin\setWLSEnv.cmd or                                                   #
#source $WL_HOME/server/bin/setWLSEnv.sh                                               #
#java weblogic.WLST Folder_Loc/changeConsumerJMSThreadsConfigProperties.py             #
########################################################################################
from java.io import FileInputStream
import java.lang
import string
from javax.jms import TextMessage
from javax.jms import ObjectMessage
import sys

#read properties file
propInputStream = FileInputStream("domain.properties");
configProps = Properties();
configProps.load(propInputStream);


adminusername = configProps.get('ADMIN_USERNAME');
adminpassword = configProps.get('ADMIN_PASSWORD');
adminurl = configProps.get('ADMIN_URL');
connect(adminusername, adminpassword, adminurl)
domainName=cmo.getName();
serverList = cmo.getServers();
server1=serverList[1].getName();




def __changeConsumerJMSThreadsConfigProperties():
 domainRuntime();
 CompositeNames = configProps.get('CompositeNames')
 CompositeName = String(CompositeNames).split(",")
 soaBean = ObjectName('oracle.soa.config:Location='+server1+',name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
 composites = mbs.getAttribute(soaBean, 'DeployedComposites')
 for composite in composites:
  x = str(composite).split(",");
  z = x[13].split("=");
  a = z[2];
  X = String(a).split("/")
  partitionName = X[0];
  Y = (X[1].split("!"))
  processName = Y[0];
  for i in CompositeName:
   SCAServiceName = configProps.get('SCAService.'+i)
   JMSAdapterReceiveThreadsTimeout = configProps.get('adapter.jms.receive.timeout.'+i)
   JMSAdapterReceiveThreads = configProps.get('adapter.jms.receive.threads.'+i)
   if processName == i:
    Z = Y[1].split("*")
    revision = Z[0];
    labelName = Z[1];
    SCACompositeConfigObject = ObjectName('oracle.soa.config:SCAComposite.SCAService='+SCAServiceName+',name=AdapterBinding,revision='+revision+',partition='+partitionName+',SCAComposite="'+processName+'",Location='+server1+',label='+labelName+',j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
    params1 = ['adapter.jms.receive.timeout',JMSAdapterReceiveThreadsTimeout]
    params2 = ['adapter.jms.receive.threads',JMSAdapterReceiveThreads]
    params3 = ['adapter.jms.receive.timeout']
    params4 = ['adapter.jms.receive.threads']
    sign = ['java.lang.String','java.lang.String']
    sign1 = ['java.lang.String']
    print 'Deleting JMSAdapterReceiveThreadsTimeout for Composite Name :  '+processName
    mbs.invoke(SCACompositeConfigObject, 'removeProperty', params3, sign1)
    print 'Deleting JMSAdapterReceiveThreadsCount for Composite Name :  '+processName
    mbs.invoke(SCACompositeConfigObject, 'removeProperty', params4, sign1)
    print 'Setting JMSAdapterReceiveThreadsTimeout for Composite Name :  '+processName
    mbs.invoke(SCACompositeConfigObject, 'setStringProperty', params1, sign)
    print 'Setting JMSAdapterReceiveThreadsCount for Composite Name   :  '+processName
    mbs.invoke(SCACompositeConfigObject, 'setStringProperty', params2, sign)

 
# MAIN

#****************************************************************************

#

# Calling all the Methods here

print(' ————————– ')

print('Starting the changes')

print('#########################################################################################################################')

print 'Do you want to tune ConsumerJMSThreadsConfigProperties'

input = raw_input("Press y to PROCEED or press n to SKIP ===================================================>                          ");

if input == 'y':
 __changeConsumerJMSThreadsConfigProperties()
else:
 exit();



print ('##########################################################################################################################')

print(' ————————– ')

print 'Changes Completed succesfully.You can restart the servers now'

Friday, May 17, 2013

Understanding Administration Console Server's State and Health



















Case 1: A managed server starts in "Managed Server Independent Mode" when it cannot successfully connect to it's corresponding Administration Server. Consequently, Administration Console "Summary of servers" table lists SHUTDOWN state and blank health state of the server.

Case 2: When a Managed Server is started through node manager, in case that the Administration Server can not be successfully be located during Managed Server start up, for any reason such as networking problems or on purpose we specify unreachable ADMIN_URL with server start arguments, managed server will run in Managed Server Independent Mode, Administration Console "Summary of servers" table lists server in RUNNING state as well as blank health state of the server.

Unknown health state

In both previous cases, the Administration Console "Summary of Servers" table lists a blank Health state for both server1 and server2. For server2 we can understand that this is because the server is not running, however now focusing on server1, the Administration Server is able to retrieve the RUNNING state of it fetching it from node manager but why it can not determine it's Health state? Administration server is perfectly capable of launching a JMX Connection to the managed server and get the Health state, however WebLogic Administration Infrastructure doesn't work in that way.
Managed server tries to connect to administration server via JMX during startup

When connected, The server generate log entry as following:

<BEA-149511> <Established JMX Connectivity with the Adminstration Server AdminServer at service:jmx:t3://localhost:7001/jndi/weblogic.management.mbeanservers.domainruntime.>

When connect failed, The server generate log entry as following:

<BEA-141151> <The admin server could not be reached at http://localhost:2001.>
<BEA-150018> <This server is being started in managed server independence mode in the absence of the admin server.>
Administration cosole get managed server health state

The administration MBeanHome interface provides type-safe access to Administration MBeans, all Local Configuration MBeans for all server instances in the domain, and all Runtime MBeans for all server instances in the domain. For example, a query for ServerRuntime MBeans on the administration MBeanHome returns one ServerRuntime MBean for each running server in the domain. It uses RMI to contact MBeans on Managed Servers, which uses more network resources.



WLST script to list all Composites deployed and the details (Label/Partition/processName)

WLST script to list all Composites deployed and the details (Label/Partition/processName)
###############################################################################################                                                                                              # List All Deployed Composites
#This WLST script lists all Composites deployed and the details (Label Partition and processName)
# @Team Fusion
########################################################
#Can attach properties file to this script.            #
########################################################
#read properties file
#propInputStream = FileInputStream("domain.properties");
#configProps = Properties();
#configProps.load(propInputStream);
#adminusername = configProps.get('ADMIN_USERNAME');
#adminpassword = configProps.get('ADMIN_PASSWORD');
#adminurl = configProps.get('ADMIN_URL');
#connect(adminusername, adminpassword, adminurl)
########################################################
#Running the script                                    #
########################################################
#WL_HOME\server\bin\setWLSEnv.cmd or
#source $WL_HOME/server/bin/setWLSEnv.sh
#java weblogic.WLST Folder_Loc/listComposites.py
################################################################################################

from java.io import FileInputStream
import java.lang
import string
import sys
from jarray import *
connect('weblogic', 'welcome1', 't3://localhost:7001')
domainName=cmo.getName();
serverList = cmo.getServers();
server1=serverList[1].getName();
domainRuntime()
soainfraBean = ObjectName('oracle.soa.config:Location='+server1+',name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
composites = mbs.getAttribute(soainfraBean, 'DeployedComposites')
for composite in composites:
    x = str(composite).split(",");
    z = x[13].split("=");
    a = z[2];
    X = String(a).split("/")
    partitionName = X[0];
    Y = (X[1].split("!"))
    processName = Y[0];
    Z = Y[1].split("*")
    revision = Z[0];
    labelName = Z[1];
    print processName
    print labelName
    print revision
 
Blogger Profile