Thursday, August 25, 2011

Thread dump in windows

on the command prompt (cmd)
go to the weblogic path ex: D:\work\wls\user_projects\domains\base_domain>
set environment variables ex: D:\work\wls\user_projects\domains\base_domain>setEnv.cmd
enter below command
ex: D:\work\wls\user_projects\domains\base_domain> java weblogic.Admin -url t3://localhost:7001 -username weblogic -password welcome1 THREAD_DUMP
replace t3://localhost:7001 with your console address
replace weblogicwith your console username
replace welcome1with your console password
enter the last command 5 times in 5 seconds.

You can also use WLST
connect('username','password','t3://ip:port') threadDump('true', 'td1.txt') 

         if you are using SSL
>java weblogic.WLST 
>connect('username','password','t3s://ip:port') threadDump('true', 'td1.txt') 

Platform MBean Server Used

For you to find "Platform MBean Server Used" and enable it. The weblogic version has to be 10.3.3 or above.
For lower versions: us the below method.

1. start your weblogic admin and open the console.
2, invoke *\wlserver_10.3\common\bin wlst.cmd or
If you have configured SSL run below, else move to step 4
java weblogic.WLST
wls:/offline> connect()
Please enter your username [weblogic] :weblogic
Please enter your password [welcome1] :
Please enter your server URL [t3://localhost:7001] :
wls:/base_domain/edit> startEdit()
wls:/base_domain/edit !> cd ('JMX')
wls:/base_domain/edit/JMX !> ls()
drw-   base_domain
wls:/base_domain/edit/JMX !> cd ('base_domain')
wls:/base_domain/edit/JMX/base_domain !> ls()

-rw-   CompatibilityMBeanServerEnabled              true
-rw-   DomainMBeanServerEnabled                     true
-rw-   EditMBeanServerEnabled                       true
-rw-   InvocationTimeoutSeconds                     0
-rw-   ManagementEJBEnabled                         true
-rw-   Name                                         base_domain
-rw-   Notes                                        null
-rw-   PlatformMBeanServerEnabled                   false
-rw-   PlatformMBeanServerUsed                      false
-rw-   RuntimeMBeanServerEnabled                    true
-r--   Type                                         JMX

-r-x   freezeCurrentValue                           Void : String(attributeName

-r-x   isSet                                        Boolean : String(propertyName)
-r-x   restoreDefaultValue                          Void : String(attributeName

-r-x   unSet                                        Void : String(propertyName)

wls:/base_domain/edit/JMX/base_domain !> cmo.setPlatformMBeanServerUsed(true)
wls:/base_domain/edit/JMX/base_domain !> save()
Saving all your changes ...
Saved all your changes successfully.
wls:/base_domain/edit/JMX/base_domain !> exit()

For 10.3.5 and above you can simply do the below

1.) Set the Platform MBean Server Enabled from Admin Console Domain >Configuration > General >Advanced >Platform MBean Server Enabled

2.) Enable this system property in server startup scripts


Friday, August 19, 2011

Script to check the status of application in weblogic domain & send email

Place the script under *\wlserver_10*\common\bin
Trigger it like (for windows: wlst.cmd
To redirect the output to a file  ./ > robin.log
To send by email  mailx -s "status" "" < robin.log

below is code

#wlst script to check status of deployed applications

import os
import sys

connect(username, password, url)
print ' Application Deployed '

app = ls(returnMap='true')



print ' Targetted on Admin '

for appName in app:
        appState = cmo.getIntendedState(appName, "AdminServer")
        print appName, '','==>',     appState

print ' '
print ' Targetted on Cluster '

for appName in app:
        appState = cmo.getIntendedState(appName, "new_Cluster_1")
        print appName, '','==>',     appState

print ' '
print ' visit today '

change the below values to suite your respective domain's values
weblogic welcome1 t3://localhost:7001 AdminServer new_Cluster_1

so, Usage will be like   
./ > robin.log; mailx -s "status" "" < robin.log

Wednesday, August 17, 2011

check the JDBC statistics


Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Please enter your username [weblogic] :
Please enter your password [weblogic] :
Please enter your server URL [t3://localhost:7001] :t3://localhost:7003
Connecting to t3://localhost:7003 with userid weblogic …
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'base_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/base_domain/serverConfig> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with ServerRunt
imeMBean as the root.
For more help, use help(serverRuntime)
wls:/base_domain/serverRuntime> cd(‘JDBCServiceRuntime’)
wls:/base_domain/serverRuntime/JDBCServiceRuntime> cd(‘AdminServer′)
wls:/base_domain/serverRuntime/JDBCServiceRuntime/AdminServer> cd(‘JDBCDataSourceRuntimeMBeans’)
wls:/base_domain/serverRuntime/JDBCServiceRuntime/AdminServer/JDBCDataSourceRuntimeMBeans> cd(‘MyDs’)

Tuesday, August 16, 2011

Start weblogic without DB

To force WLS to not access the back end database during start up.
Datasource -> config -> connection pool -> advanced -> Connection Creation Retry Frequency (seconds)
Changing it to a non-zero value will allow WLS to boot without accessing database.

Monday, August 1, 2011

Warning: JMS queue 'weblogic.wsee.DefaultQueue' is not found

Error message:
<Server started in RUNNING mode>
 <WSEE:18>Warning: JMS queue 'weblogic.wsee.DefaultQueue' is not found, as a result, Web Service async responses via jms transport is not supported. If the target service uses JMS transport, the responses will not be able to come back.<JmsQu eueListener.connect:287>

add this in startup command line: