Search This Blog

Thursday, March 22, 2012

Execute commands remotely from unix shell

 

The ssh command on linux does not support passing the passwords at the command line ,

You need to use the sshpass command. It is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode. You can install it as follows:

rpm –ivh ftp://ftp.muug.mb.ca/mirror/fedora/epel/5/i386/sshpass-1.05-1.el5.i386.rpm

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " du  --exclude=/shared  --exclude=/shared2 -Sm / | sort -nr | head -10"

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " uptime "

Tuesday, March 13, 2012

Steps to Apply the JDeveloper stand alone patches

 

First download the standalone opatch using the patch number  5912518.
Assuming my JDev Home is : d:\fmw1115\Middleware\jdeveloper
copy d:\p5912518_111000_GENERIC.zip cd d:\fmw1115\Middleware\jdeveloper
cd d:\fmw1115\Middleware\jdeveloper
unzip -d . p5912518_111000_GENERIC.zip
set  ORACLE_HOME=d:\fmw1115\Middleware\jdeveloper
set PATH=d:\fmw1115\Middleware\jdeveloper\OPatch;%PATH%
cd C:\temp\13607268
First try ,
opatch version -jdk d:\fmw1115\Middleware\jdk160_24
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.
Now Apply the patch using ,
opatch apply -jdk d:\fmw1115\Middleware\jdk160_24
If you are applying the patch for the first time then you will see ,
> OPatch finds no 'product.xml' in Oracle Home and will attempt to create 'product.xml' file.
>
> Attempting to retrieve patch inventory's "product" and its "version" information...
>
> Please enter your choice to enable OPatch to create 'product.xml' file or quit creation...
>
>
> Choice Product Version
> ------ ------- -------
> 1 SA_JDEV 11.1.1.5.0
>
> 2. If you wish, quit 'product.xml' creation
>
> Please enter [1-2]:
> 1
> User Responded with: 1
>
> OPatch will put the information of selected product 'SA_JDEV' and selected version '11.1.1.3.0'
> in product.xml during inventory updation.
> "
Now run the command to verify whether the patch applied or not ,
C:\temp\13607268>opatch lsinventory -jdk d:\fmw1115\Middleware\jdk160_24
To remove the patch  run the command ,
cd C:\temp\13607268
opatch rollback -id 13607268 -jdk d:\fmw1115\Middleware\jdk160_24

How to apply patches to a BPM and/or SOA environment in 11.1.1.3 (Doc ID 1288864.1)

Friday, March 09, 2012

How to measure the time it takes to load a web page

 

Many times you need to find out the how long a web page takes to load when troubleshooting performance related
problems.

Here are the steps that you can use with the WebLogic Server 11g.

Home >Summary of Servers >AdminServer
Click on Loggin TAB -> HTTP and go to the Advanced Options

Select the Format as "Extended"
and add the field " time-taken" to the Extended Logging Format Fields.
For example after adding it will be
"date time cs-method cs-uri sc-status time-taken"

After this you need to restart the Server ,

This is the WLST script to do the same ,

connect('weblogic', 'Welcome1', 't3://localhost:7001')
startEdit()

cd('/Servers/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer')
cmo.setLogFileFormat('extended')
cmo.setELFFields('date time cs-method cs-uri sc-status time-taken')

activate()
disconnect()
exit()

After this you need to restart the Server ,

Check the access_log file entries ,

2012-03-09      14:19:16        GET     /em/faces/targetauth/emasLogin?target=Farm_soa_domain&type=oracle_ias_farm&FromContextInitFilter=true&_afrLoop=18992901037066&_afrWindowMode=0&_afrWindowId=null    200     0.066
2012-03-09      14:19:20        GET     /em/LoginStatusServlet?loginReqTime4emas=rlt_1331282958512_0.31560349677888955  2000.0040

The last column indicates the time.

You can measure the timings from browser also ,

for this use the FireFox version > 4.0 , here you can use the Tools-> Web Console or Tools -> Web Developer -> Web Console option.

Or you can use the fiddler tool to measure the time it takes to load web page ,
download the fiddler from ,
http://fiddler2.com/fiddler2/

Fiddle tool can be used with IE or firefox.

Wednesday, March 07, 2012

Unable to start the WebLogic Server weblogic.security.SecurityInitializationException: Authentication for user weblogic denied

 

Getting the following exception when trying to start the WebLogic Server

<Mar 7, 2012 3:57:29 PM IST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:965)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1050)
        at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
Caused By: javax.security.auth.login.FailedLoginException: [Security:090303]Authentication Failed: User weblogic weblogic.security.providers.authentication.LDAPAtnDelegateException: [Security:090295]caught unexpected exception
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:251)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        Truncated. see log file for complete stacktrace


Follow the following steps:
1: remove the boot.properties file completely from the managed server directory.
2: remove the ManagedServerDir/data/ldap directory completely.
3: Always keep backup of files before removing it.
4: Now try to start the server from the command prompt and provide the username/password used to login to the Admin Console.

Monday, March 05, 2012

WLST SOA MBeans Examples

 

// Get the deployed Composites

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()
soaBean = ObjectName('oracle.soa.config:Location=AdminServer,name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
print soaBean
composites = mbs.getAttribute(soaBean, 'DeployedComposites')
for composite in composites: 
print 'composite: ',composite 
disconnect()
exit()


// Change the Composite auditLevel to Development

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:Location=AdminServer,partition=default,j2eeType=SCAComposite,revision=1.0,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,Application=soa-infra,wsconfigtype=WebServicesConfig,name="File1"')
print helloworldComposite
params = ['auditLevel','Development']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setProperty', params, sign)
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()


// Print the Composite Properties

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Change the ExcludeFiles property of the File Adapter

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print '-----------Before Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
params = ['ExcludeFiles','*.akshay*']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setStringProperty', params, sign)
print '-----------After Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Display the MDS listPartitions

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()

mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')

print 'invoke listRepositories without parameters on mds bean'
repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
for repository in repositories:
mdsObject = ObjectName(repository)
Name = mbs.getAttribute(mdsObject, 'Name')
print 'mds repository object: ', Name
params = [Name]
sign = ['java.lang.String']
partitions = mbs.invoke(mdsBean, "listPartitions", params, sign)
for partition in partitions:
   print 'partition: ', partition
disconnect()
exit()