Thursday, 14 December 2017

Thread Dump:



1.            What is Thread dump?
2.            When we will take Thread dump? (Scenarios)
3.            How  Many  ways take Thread Dumps
4.            Thread Dump Generating Procedure
5.            What can I Analysis with Thread Dump?
6.            How can I analysis thread dump?
7.            Actions taken for Issue resolving
8.            References

 Coming to step by step learning:
--------------------------------

What is Thread dump?

Thread Dump is a textual dump of all active threads and monitors of Java apps running in a Virtual Machine.

When we will take Thread dump? (Scenarios)

1.  Scenario 1: when server is hang Position, i.e. that time server will not respond to coming requests.

2.  Scenario 2: While sever is taking more time to restart

3.  Scenario 3: When we are Getting exception like “java.lang.OutOfMemoryException”

4.  Scenario 4: Process running out of File descriptors. Server cannot accept further requests because sockets cannot be created

5.  Scenario 5: Infinite Looping in the code


How many ways take Thread Dumps?

Many types we have to take a Thread dumps. As per your flexibility you can choose one Procedure. For analyzing take dumps some Intervals (like every 10mins, 10mins etc.).



Generating Dump Talking Procedures

1. Take Thread dump from Console by Using of below command
    $kill -3 PID
   (For Getting PID, Use this Command ps –ef | grep “java”)
Here The Output of the Thread Dump will be generated in the Server STDOUT.
(Note: If a process is not responding to kill -3 then it’s a JVM bug.)


2. Generation Thread Dump via Admin Console

a.  login to Admin Console(with Admin Username/Password)
b.  Click on Server, after choose your server
c.  Goto Monitoring TAB
d.  Goto Threads TAB, after click on “Dump Thread Stack” Button
e.  Now you can view the all the Threads in Same page
f.  Copy and paste in a txt file.

3.  We can Collect Thread Dump Using “WebLogic.Admin” which is deprecated, but still available or may be available in near future as well As i think because it is one of the best debugging utility for Admins.

  java WebLogic.Admin -url t3://hostname: port -username Weblogic -password Weblogic THREAD_DUMP


This Thread Dumps will be generated in Servers STDOUT file


4. Getting Thread Dumps by using Jstack Utility

    a.jstack –m (to connect to a live java process)

    b. jstack –m [server_id@]
                (to connect to a remote debug server)
    (-m Means print both java and native frames (mixed mode)) 
process ID: jps

[soaosb]-->jps

19234 Server

17786 Server

11653 TMMain

18087 NodeManager

23300 Jps

18414 Server

18886 Server


example: -->$JAVA_HOME/bin/jstack -l 19234 > osb1.tdump

5. By Using WLST Script, can contain extension of (.py)

connect(‘weblogic’,'weblogic’,'t3://hostname:port′) cd (”Servers’) ls()cd (‘AdminServer’) ls() threadDump()

 Execute this Script in console. 

What can I Analysis with Thread Dumps?
We need to analyze the thread dumps for analyzing running threads and their states to identifying.

How can I analysis thread dumps?

For analyze thread dumps we have lots of tools to understand easily thread states

1.  samurai tool :

    In this tool you can identify all the Thread states by     identifying colors. We need to take care about Deadlocks and waiting state threads.

   More Details:

    $ java -jar samurai.jar

     After running we will get a Screen like below

      Goto Thread dump tab
    When Samurai detects a thread dump in your log, a tab named "Thread Dump" will appear.

 You can just click "Thread dumps" tab to see the analysis result. Samurai colors idle threads in gray, blocked threds in red and running threds in green. There are three result views and Samurai shows "Table view" by default. In many case you are just interested in the table view and the sequence view. Use the table view to decide which thread needs be inspected, the sequence view to understand the thread's behavior. You should takecare especially threds always in red.


2.  TDA Tool :


Actions taken for Issue resolving

1.  Classic Dead Locks : Look for the threads waiting for monitor entry

For Example :

"ExecuteThread: '95' for queue: 'default'" daemon prio=5 tid=0x411cf8 nid=0x6c waiting for monitor entry [0xd0f80000..0xd0f819d8]
    at weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java:766)
    at weblogic.jdbc.common.internal.ConnectionEnv.destroy(ConnectionEnv.java:590)
Reason: The above thread is waiting to acquire lock on Resource Allocator object. The next step is to identify the thread that is holding the Resource Allocator object
"ExecuteThread: '0' for queue: '__weblogic_admin_rmi_queue'" daemon prio=5 tid=0x41b978 nid=0x77 waiting for monitor entry [0xd0480000..0xd04819d8]
    at weblogic.jdbc.common.internal.ConnectionEnv.getPrepStmtCacheHits(ConnectionEnv.java:174)
    at weblogic.common.internal.ResourceAllocator.getPrepStmtCacheHitCount   (ResourceAllocator.java:1525)
Reason: This thread is holding lock on source Allocator object, but is waiting for Connection Env object. This is a classic deadlock.

      
2.  Threads in wait() state:
   A sample dump:

"ExecuteThread: '10' for queue: 'SERV_EJB_QUEUE'" daemon prio=5 tid=0x005607f0 nid=0x30 in Object.wait() [83300000..83301998]
  at java.lang.Object.wait(Native Method)
  - waiting on (a weblogic.ejb20.pool.StatelessSessionPool)
at weblogic.ejb20.pool.StatelessSessionPool.waitForBean(StatelessSessionPool.java:222)

Reason: The above thread would come out of wait() under two conditions
 (Depending on application logic)
1) One of the thread available in the execute queue pool would call notify() on this object when an instance is available. (If the wait() is indefinite).
  This can cause the thread to hang for ever if server never does a notify() to this object.

2) If the timeout exceeds, the thread would throw an exception and back to execute queue thread pool.

What is lok file ?how many types of lok files are there?



lok files are for locking some action which should be run or made only by one user or holding process. You can find config.lok invoked for serial update of config.xml, then each server has its own lok file for server and lok file for embedLDAP to avoid start same manged server in time twice. Then you can find edit.lok invoked by Edit actions for one user editing domain configuration in time. I am not sure if other exist.

It is good to know it, because sometimes when server crash you cant start servers and it writes something like "Instance is already running" Or second issue server begin to start and then after line in log with text "....IIOP..." next step is load embedLDAP but server stuck for long time in this step because ldap is locked or corrupted. Remove of these lok files usually can help you to start server perfectly again

How to change / reset weblogic admin user password



Some engineers think it's just a single step to change the weblogic admin user password from console under realm option, but it's not really a single step because if you do change the admin user password from console only then you would able to logout with existing session and login with new password but you would not able start your server once you will brought it down untill and unless you will do some more workaround which is the part of weblogic admin user password change procedure.


if you will only change the admin user password from console and after that try to start your admin server you will get below error

*********************************************************************************

hentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may hav
e been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The firs
t time the updated boot identity file is used to start the server, these new values are encrypted.
weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (bo
ot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file wit
h the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted. at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:959)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:090304]Authentication Failed: User weblogic javax.security.auth.login.FailedLoginException:
 [Security:090302]Authentication Failed: User weblogic denied
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:261)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
*********************************************************************************

To avoid this you have to update the admin server boot.properties file also
So, here is the procedure to change the weblogic admin user password

Part A.
Login to admin  console
Under Domain Structure, select “Security Realms” option
Click on “myrealm”
Click on tab “Users and Groups"
Click on your admin user
Click on the Passwords tab
Update the password

Part B.
Logout and login again with new password to make sure you are able to login with new password. ( if you are not able login with new password then it means you have updated something else and trying with something else :)  )
Ok, now


1. Stop your admin server
2. Go to your_domain/servers/you_admin_server/security directory
3. Take backup of existing boot.properties file
4. Create new boot.properties file with below contents
username=your_admin_user
password=your_new_password

5. Now start your admin server

Wait, its not over, If you have managed servers in your domain then you have to do some more workaround for them to boot up properly during next restart

Important :
If you always start your managed servers from console and never started using command line ( using startManagedserver command ) by you or by anyone since provisioning ( means setup of  environment ) then you will not see any boot.properties file under your managed server(s) staging security directory ( your_domain/servers/your_managed_server/security ) and if will try to start managed servers using script then you will be prompt for username and password always untill and unless you will create boot.properties manually under your_domain/servers/your_managed_server/security directory.
If you have changed admin user password ( using the way I have mentioned above ) then you would able to stop start login admin console successfully but you will not able to start managed servers once you will stop them ( you will get same above highlighted exception in logs ) untill and unless you will do below work around

Workaround - 1
1. Go to "your_domain/servers/your_managed_server/data" for each managed server you have    
    and rename ldap folder to ldap.old and nodemanager folder to nodemanager.old
2. Start managed server(s) from console

Workaround - 2
if you still getting same authentication exception then including workaround-1 first step, follow below steps also
1. Change the nodemanager password from admin console also
Login to admin console
Click on your domain name ( on left hand tree under Domain Structure )
Click on security tab
Click on advance option link
Change "NodeManager Password:"

2. Go to your WL_HOME/common/nodemanager folder and rename nm_data.properties file as nm_data.properties.old
3. Restart node manager
4. Start your managed servers


Thursday, 19 October 2017

GridLink Data Source

                                          


A GridLink data source lets you provide connectivity between WebLogic Server and an Oracle RAC database service, which is targeted to an Oracle RAC cluster. Database services are abstractions for workloads with common characteristics. A GridLink data source is independent of the number of nodes in a RAC cluster. You can use Oracle SCAN (Single Client Access Name) addresses to configure both the Transparent Network Substrate (TNS) and Oracle Notification Service (ONS) listeners. Using a SCAN address means that you don't need to change anything when you add or remove nodes from the RAC configuration.

Configuring the GridLink Data Source

The simplest way to create a GridLink data source connection pool is using the WebLogic administration console. The steps are very similar to creating a single instance data source, except that there are a few additional questions, especially pertaining to ONS.
Firstly go to create a JDBC data source and choose the GridLink option:
Now, like a regular data source, you are asked for details about its JNDI name and transaction support:
 Usually you will use the wizard to set up the JDBC URL for you:
Now enter details about the RAC database, service and user. Note my example here uses VIP names (which you should always use for 10.2 and above RAC databases), though you should be able to use a SCAN instead if you are using an 11.2 database.
  
Next you are presented a deep screen with all the database access details, including the innocuous looking test table, and a convenient button to test the database connection to all listeners in the cluster. Note you still don't have the option on this screen to change the pool size which puzzles me - in any non-trivial environment that is something you always want to do and yet you have to go back into the configuration afterwards to amend it.
  
Now this is where things get interesting! You'll see the "FAN enabled" tick-box and a place to enter the ONS details typically, though not necessarily, on the database servers. This is ticked by default and the UI makes sure you enter at least one ONS server (of course, as FAN is not going to work otherwise).
You'll also notice the wallet parameters which allow the ONS messages to be sent over SSL - usually a good practice in production.
 
The next page allows you to test connectivity with the ONS servers. This is handy as in production you will probably have requested firewall ports to be opened between the application server DMZ and the database zone and this allows you easily verify such a change is working. 
Finally, as for other types of data source, you choose which (usually) managed servers to assign it to, and then you're done.
Note I have had a warning message at this point but the data source was still activated - I'm not sure why. In this case it was happy though:
This is how my configuration looks in the JDBC file referenced from the domain's config.xml:


  racb-ds
 
    jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=westfield03)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=westfield04)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=appa)))
    oracle.jdbc.OracleDriver
   
     
        user
        hr
     

   

    {AES}...
 

 
    5
    15
    1
    SQL SELECT 1 FROM DUAL
    10
    LRU
 

 
    jdbc/racb-ds
    OnePhaseCommit
 

 
    true
    westfield03:6200,westfield04:6200
   
 
What is interesting to me about this is that it is almost identical to a regular/'generic' Oracle JDBC data source - the only difference (for the same transaction regime) is the additional properties (shown above in bold).

Monitoring

You can monitor a GridLink data source through the WebLogic administration console in the same way as multi data sources, e.g. numbers of connections to each RAC instance. There are new tabs for ONS though which allow you to check connectivity once the data source is running:
You can also view the data source status, like any other, on the Monitoring Dashboard:


Licensing

This section is no longer relevant - see later blog post 27/7/11 
As I mentioned earlier, at the time of writing, the functionality described above is not included in any of the WebLogic Server licences (Basic, Standard, Enterprise or Suite). You are only allowed to use this feature in test and production environments if you have one of:
  • an Exalogic Server: starting at $475,000 for a quarter rack (8 computer nodes) hardware, plus WebLogic licences etc, or,
  • the Exalogic Elastic Cloud software: this costs an additional $20,000 per Oracle Processor on top of WebLogic Suite.
Note even if you have an Exadata you are still not allowed to use GridLink data sources from a non-Exalogic WebLogic installation unless you have bought the Exalogic Elastic Cloud software.
As most people know, the Oracle licensing police don't take prisoners so if you're not on Exalogic and haven't paid for the extra Elastic Cloud licences you need to make sure your WebLogic administrators are fully aware that they mustn't use GridLink Data Sources. Note: I haven't seen of a way to switch off their availability in the console. Also, as you can see from the earlier configuration snippet, it is easy for Oracle to tell if you are using a GridLink data source, and I am sure their use will be included in auditing scripts.

Wednesday, 18 October 2017

WebLogic 12.1.2 Futures


WebLogic 12.1.2 Futures
1. Dynamic Cluster Support:
It is one of the most striking features of WebLogic 12.1.2. This release introduces use of the dynamic cluster for a highly scalable systems, high availability environment.  Dynamic cluster allows the managed servers to be automatically added based on a server template.
2. Support with Oracle Database 12c.
3. JMS enhancements:
Supports clustered targeted JMS Servers for providing high availability  eliminating the need to configure many JMS resources for every single server.
4. Enhanced maven support.
Support for POMs, Maven 3.0.4.
5. WebSocket support.
Supports for WebSocket Protocol (RFC 6455),which provides two-way, full-duplex communication over a single TCP connection between clients and servers, where each side can send data independently from the other. The WebSockets communication model occurs in real-time and promotes user interaction.

Weblogic 12.1.2 Update

Weblogic 12.1.2 Update

Note:

As of WebLogic Server 12.1.2, Oracle no longer provides upgrade installers. You must install WebLogic Server 12.1.2 to a new directory location. You cannot install it over an existing installation.

Weblogic 12.2.1.1 Install



Steps to install weblogic 12.2.1.1

step1: Create oraInst.loc

oraInst.loc
inst_group=soa
inventory_loc=/apps



step2 : Create .rsp file, Update the ORALCE_HOME Variable


WLS1221ResponseFile.rsp


#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0

[GENERIC]

#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/apps/Oracle/1221/oracle_home
#Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.
INSTALL_TYPE=Complete with Examples

#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
MYORACLESUPPORT_USERNAME=

#Provide the My Oracle Support Password
MYORACLESUPPORT_PASSWORD=

#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true

#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

#Provide the Proxy Host
PROXY_HOST=

#Provide the Proxy Port
PROXY_PORT=

#Provide the Proxy Username
PROXY_USER=

#Provide the Proxy Password
PROXY_PWD=

#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
COLLECTOR_SUPPORTHUB_URL=
 

Step3:Run the below command

 java -Djava.io.tmpdir=/apps -jar /apps/fmw_12.2.1.1.0_wls.jar -silent -invPtrLoc /apps/oraInst.loc -responseFile /apps/WLS1221ResponseFile.rsp -logLevel severe -debug
 

o/p