Gone through lots of Weblogic Administration  Interview in this year with companies like Oracle, Cognizant, Tech Mahindra, Vodafone, IBM etc. I'm trying to post here some common weblogic interview questions with Answers. Please read and post/ask any questions & Answers you have come across recently.

Q) APPLICATION SERVER Vs WEB SERVER 
(1) It has got app container (and obviously web container) inside it and thus EJB can be deployed in it 'Vs' (1)It has got web container inside it and it acts as front end where JSPs are deployed on it.
(2) Main business logic is deployed on the app server   'Vs' (2) It is used as proxy in front of app server for load balancing.
(3) Examples of commonly used app servers in market are Weblogic, Websphere, JBoss  'Vs' (3) Examples of commonly used web servers are apache, IIS, Iplanet.


Q) FEATURE OR ADVANTAGES OF APP SERVER?
1.Clustering
2.Loadbalancing
3.High availibility
4.Failover


Q) SESSION REPLICATION:
It is the mechanism by which session & session related data is transferred to other cluster members.


Q) Types of session replication:
1.In-Memory:
Client first connects to a server and that server becomes the primary server. The primary server then copies the data on to a server and the other cluster members  fetches the session data from that server and also the other server keeps their session data on to that server and the primary server fetches that session data from  that server, and,  thus all the servers keep updated with the latest session data.
NOTE: This type of session replication is internally used by weblogic if we do not define below mentioned strategies.

2.Memory:
Session data is stored in the memory (cache). After restart the session data get lost.

3.Cookie:
Session data gets stored in the user's browser.

4.File:
This is File based session replication wherein the session data gets stored in an xml file.

5.JDBC:
The session data is stored in DB (i.e persistent store).

NOTE:  2,3,4,5 are defined inside weblogic.xml inside <session-descriptor> tag.

--------------------------------
Commonly known error:
--------------------------------
ERROR: Java.io.Not serializable Exception
REASON (can be):
A non serializable object inside HTTP session which is not replicating to other cluster members.




Q) MULTICASTINGs  Vs UNICASTING
Here by Multicasting / Unicasting, servers in a cluster communicate with each other by sending heartbeats and indicates that they are alive. For this communication between the servers, either unicast or multicast messaging is used.

This is choosen from the admin console:
Cluster> Configuration> Messaging > Messaging mode

MULTICASTING :
1.This is one to many type of communication, wherein, the cluster members sends their heartbeat messages to all other members in the cluster.
2.Multicast address and multicast port is required.
3.This often results into network latency.

UNICASTING:
1.This is one to one type of communication, wherein, one leader is elected among the cluster members and the cluster members send their heartbeat messages "one to one"  to this leader and it polling (updating) the other members one by one.
2.Here NETWORK CHANNEL (NIC) is required for communication.
3.This never results into network latency.


--------------------------------
Commonly known error:
--------------------------------
ERROR: Multicast<Critical subsystem cluster has failed. Setting server state to FAILED.

REASON:Unable to receive set of multicast messages

SOLUTION:
1. Multicast port must be properly defined.
2. Use the debug flags (debug cluster, debug cluster Heartbeats) and then check the logs.
3. Run the multicast test (not at the top of my head as of now).

ERROR: <BEA-003108> <Unicast receive error:java.io.EOF Exception>
SOLUTION: Make sure that NIC is functioning properly with your network team.

Q) DIFFERENCE BETWEEN WLS8 AND LATER VERSIONS:

WEBLOGIC8:
1.Here connection pool and multipool was there and we needed to target explictly on the datasource.
2.Supports only Multicasting .
3.Execute queues was there.
4.config.xml was large which contains the information related to JMS, JDBC inside it.
5.No Lock&Edit feature was available.

WEBLOGIC9 ONWARDS:
1.Here data source and multi datsource are in use.
2.This supports unicasting and multicasting as well for backward compatibility.
3.Workmanagers in place of execute queues.
4.Here config.xml is divided into there config file:
jdbc-config.xml, jms-config.xml, xonfig.xml
5.Lock&Edit feature is avaailable.

Q) CONNECTION CAN EITHER BE IN FOLLOWING ONE OF THE STATES:
1.Listen
2.Establish
3.Closed
4.Closed_wait


Q) LOGGING LEVELS:
1.Info
2.Debug
3.Warning
4.Critical
5.Error


Q)  jrcmd Commands Taking Heap and Thread dumps 
...\jrockit_jdk\bin\jrcmd -->List all JRockit JVM processes running on the machine
...\jrockit_jdk\bin\jrcmd <PID> print_threads -->Take thread dumps
...\jrockit_jdk\bin\jrcmd <PID> print_memusage -->Print Memory Usage
...\jrockit_jdk\bin\jrcmd <pid> hprofdump filename=/tmp/jrockit1.hprof -->Take Heap Dump
...\jrockit_jdk\bin\jrcmd <pid> heap_diagnostics -->Analyse biggest/culprit java classes


Q) WLS VERSIONS AND SUPPORTED O.S AND JDK VERSIONS:

WLS10.3.5.0--> Sun JDK 1.6.0_24+  & RHEL5


Version Packs Name Supported JDKs versions Supported Linux versions
WLS 8 Service pack (SP) JDK 1.4 RHEL3,4
WLS  9 Maintanance pack (MP) JDK1.4 and  1.5 RHEL3,4,5
WLS 10 Maintanance pack (MP) JDK 1.5 and 1.4 RHEL4,5
WLS 11 Patchset JDK 1.6 RHEL4,5

WLS10G
WLS10.0.1= 10.0 MP1
WLS10.0.2= 10.0 MP2

WLS 11G
WLS10.3.0.0 (Baseversion)
WLS 10.3.1.1 (Patchset0)
WLS 10.3.1.2 (Patchset1)
WLS  10.3.1.3 (Patchset2)
WLS  10.3.1.4 (Patchset3)
WLS  10.3.1.5 (Patchset4)
WLS  10.3.1.6 (Patchset5)


Q) DIFFERENCE BETWEEN DEVELOPMENT AND PRODUCTION MODE

Development mode:
The default JDK for development domain is Sun Hotspot
You can use the demo certificates for SSL
Auto deployment is enabled
Server instances rotate their log files on startup
Admin Server uses an automatically created boot.properties during startup
The default maximum capacity for JDBC Datasource is 15
The debugFlag which is used to start the WebLogic Workshop Debugger is enabled

Production mode:
The default JDK for production domain is JRockit
If you use the demo certificates for SSL a warning is displayed
Auto deployment is disabled
Server instances rotate their log files when it reaches 5MB
Admin Server prompts for username and password during startup
The default maximum capacity for JDBC Datasource is 25
The debugFlag which is used to start the WebLogic Workshop Debugger is disabled.


Q )MODES OF DEPLOYMENT

Stage mode:
The Administration Server copies the archive files from their source location to a location on each of the targeted Managed Servers that deploy the archive. For example, if you deploy a J2EE Application to three servers in a cluster, the Administration Server copies the application archive files to each of the three servers. Each server then deploys the J2EE Application using its local copy of the archive files.
Stage mode is the default mode when deploying to more than one WebLogic Server instance.

Nostage mode:
The Administration Server does not copy the archive files from their source location. Instead, each targeted server must access the archive files from a single source directory for deployment. For example, if you deploy a J2EE Application to three servers in a cluster, each server must be able to access the same application archive files (from a shared or network-mounted directory) to deploy the application.
Nostage mode is the default mode when deploying only to the Administration Server (for example, in a single-server domain). You can also select nostage mode if you run a cluster of server instances on the same machine.

External_stage mode:
External_stage mode is similar to stage mode, in that the deployment files must reside locally to each targeted server. However, the Administration Server does not automatically copy the deployment files to targeted servers in external_stage mode; instead, you must manually copy the files, or use a third-party application to copy the files for you.


Q) JDBC (JAVA DATABASE CONNECTIVITY) Interview Questions
The JDBC contains 2 important topics- Connection Pool and Datasource.

-------------------------------
CONNECTION POOL:
-------------------------------
A connection pool contains a group of JDBC connections which can be readily used by the applications.
These JDBC connections are created when the connection pool is registered, usually when starting up weblogic server.
The application borrows a connection from the connection pool, uses it,  then returns it to connection pool by closing it.

Click on weblogic console L.H.S > JDBC > Now you need to feed DB name, DB username and password, Driver name and below mentioned JDBC parameters. Also, if we select
the correct values as per our application's need, then this will tune the application's performance to optimum level.

-------------------------
JDBC known errors:
-------------------------
Generally we see the following type of errors while dealing with JDBC issues:
<Warning> <JDBC> <BEA-001129> <Received exception while creating connection for pool "myds1": ORA-00257: archiver error. Connect internal only, until freed.>

The errors require optimum tuning of JDBC parameters.


JDBC TUNING PARMETERS:
--------------------------------
1.INITIAL CAPACITY:
--------------------------------
The number of physical database connections to create when creating the connection pool.

VALUE CONSTRAINTS:-
Minimum: 0
Maximum: 214,74,83647
Default: 1
Dynamic: yes


----------------------------
2Minimum Capacity:
----------------------------
The minimum number of physical connections that this connection pool can contain after it is initialized.
Minimum value: 0
Maximum value: 2147483647

---------------------------
3.Maximum Capacity:
----------------------------
Maximum number of physical database connections that this connection pool can contain. Different JDBC Drivers and database servers may limit the number of possible  physical connections.

Set the Maximum Capacity of the connection pool at least equal to the Execute Thread Count.
The MaxCapacity attribute of the JDBCConnectionPool element allows to set the maximum number of physical database connections that a connection pool can contain.
Different JDBC drivers and database servers might limit the number of possible physical connections.
In production, it is advisable that the number of connections in the pool equal the number of concurrent client sessions that require JDBC connections

VALUE CONSTRAINTS:-
Minimum: 1
Maximum: 214,74,83,647
Default: 15
Dynamic: yes

NOTE:
**set Initial Capacity equal to Maximum Capacity.
**If InitialCapacity is less than MaxCapacity, the server then needs to create additional database connections when its load is increased

-----------------------------
4.Capacity Increment:
-----------------------------
Increment by which the connection pool capacity is expanded. When there are no more available physical connections to service requests, the connection pool will create this number of additional physical database connections and add them to the connection pool. The connection pool will ensure that it does not exceed the maximum number of physical connections as set by MaxCapacity.

VALUE CONSTRAINTS:-
Minimum: 1
Maximum: 2147483647
Default: 1
Dynamic: yes


------------------------------------------------
5.Statement Cache Type: (NOT Imp)
------------------------------------------------
The algorithm used to maintain the statement cache:
LRU - After the statementCacheSize is met, the Least Recently Used statement is removed when a new statement is used.
FIXED- The first statementCacheSize number of statements is stored and stay fixed in the cache. No new statements are cached unless the cache is manually cleared.

**Select the least-recently-used (LRU) algorithm for the cache; this removes rarely-used statements from the cache.

**Use the statement cache to improve performance of prepared and callable statements.
The prepared statement cache keeps compiled SQL statements in memory, thus avoiding a round-trip to the database when the same statement is used later.

VALUE CONSTRAINTS:-
Default: LRU
Valid values:
LRU
FIXED
Dynamic: no


--------------------------------------------
6.Statement Cache Size: (Not imp)
--------------------------------------------
The number of Prepared and Callable Statements stored in the cache for further use. WebLogic Server can reuse statements in the cache without reloading them, which can  increase server performance. Setting the size of the statement cache to 0 turns it off. Each connection in the pool has its own cache of statements.

VALUE CONSTRAINTS:-
Default: 10
Dynamic: yes


**************************ADVACEDOPTIONS:************************

--------------------------
7.Shrink Frequency:
--------------------------
Number of seconds to wait before shrinking a connection pool that has incrementally increased to meet demand. ShrinkingEnabled must be set to true for a connection  pool to shrink.

VALUE CONSTRAINTS:-
Units: seconds
Minimum: 0
Maximum: 2147483647
Default: 900
Dynamic: yes


------------------------
8.Allow Shrinking:
------------------------
Indicates whether or not the pool can shrink back to its InitialCapacity when it is detected that connections created during increased traffic are not being used.
When shrinking, the number of connections is reduced to the greater of either the initial capacity or the current number of connections in use.

VALUE CONSTRAINTS:-
Default: true
Valid values:true/ false
Dynamic: yes


------------------------------------------------
9.Enable Connection Leak Profiling:
------------------------------------------------
Specifies that JDBC Connection leak profiling information is gathered.
A Connection leak occurs when a connection from the pool is not closed explicitly by calling close() on that connection.

When connection leak profiling is active, the connection pool will store the stack trace at the time the Connection object is allocated from the connection pool and given to the client. When a connection leak is detected (when the Connection object is garbage collected), this stack trace is reported.

This option is required to view leaked connections from the connection pool (right-click the connection pool name and select View Leaked Connections).

This feature uses extra resources and will likely slow down connection pool operations, so it is not recommended for production use.

**The connection leak profiling option shows leaked connections from the connection pool. BEA recommends that you do not use this option in production; it uses extra resources and typically slows connectionpool operations.

VALUE CONSTRAINTS:-
Default: false
Dynamic: yes


-----------------------
10.Test Frequency:
-----------------------
The number of seconds between database connection tests. After every TestFrequencySeconds interval, unused database connections are tested using TestTableName.
Connections that do not pass the test will be closed and reopened to re-establish a valid physical database connection. If the test fails again, the connection is closed.

If TestTableName is not set, the test will not be performed.

If set to 0 (the default), connections are not tested.

**If database is restarted when WebLogic Server is running, Test Frequency can be increased from 0, so that all the connections are closed and reopened to re-establish  valid physical connection. After all the connections are recreated changing it back to 0 will disable the testing.

VALUE CONSTRAINTS:-
Units: seconds
Minimum: 0
Maximum: 2147483647
Default: 0
Dynamic: yes


---------------------------------------
11.Test Reserved Connections:
---------------------------------------
When selected (set to true), WebLogic Server tests a connection before giving it to the client. The test adds a small delay in serving the client's request for a connection from the pool, but ensures that the client receives a working connection (assuming that the DBMS is available and accessible).

The attribute TestTableName must be enabled for TestConnectionsOnReserve to be effective.

This attribute is required for connection pools used within a MultiPool that uses the High Availability algorithm.

**Use Test Reserved Connections only if you can afford the overhead of testing connections as part of normal request processing.

VALUE CONSTRAINTS:-
Default: false
Dynamic: yes


------------------------------------------
12.Connection Reserve Timeout:
------------------------------------------
This is the time out in seconds in which weblogic will call the CONNECTION POOL to reserve a CONNECTION.
When set to 0, a call will never timeout.
When set to -1, a call will timeout immediately.

VALUE CONSTRAINTS:-
Units: seconds
Minimum: -1
Maximum: 2147483647
Default: 10
Dynamic: yes


------------------------------------------------------
13.Connection Creation Retry Frequency:
------------------------------------------------------
This the time (in seconds) after which weblogic tries to connect to DATABASE to create a connection.

If you do not set this value, connection pool creation fails if the database is unavailable. If set and if the database is unavailable when the connection pool is  created, WebLogic Server will attempt to create connections in the pool again after the number of seconds you specify, and will continue to attempt to create the connections until it succeeds. When set to 0 (the default), this feature is disabled.

**Connection Creation Retry Frequency can be used to retry for establishing connections to the database, if database is not reachable when creating connection pool or  starting WebLogic Server.

VALUE CONSTRAINTS:-
Units: seconds
Minimum: 0
Maximum: 2147483647
Default: 0
Dynamic: yes

------------------------------------------
14.Inactive Connection Timeout:
------------------------------------------
The number of seconds of inactivity after which reserved connections will forcibly be released back into the pool. When set to 0 (the default), this feature is disabled.
i.e Configure Inactive Connection Timeout to specify how long (in seconds) a connection can be inactive before it is reclaimed to the pool.

VALUE CONSTRAINTS:-
Units: seconds
Minimum: 0
Maximum: 2147483647
Default: 0
Dynamic: yes


---------------------------
15.Test Table Name:
---------------------------
The name of the table used when testing a physical database connection. The default SQL code used to test a connection is
"select count(*) from TestTableName"
**Avoid using a production table for “Test Table Name”, use a dummy table (ex. dual).

VALUE CONSTRAINTS:-
Dynamic: no



USE:
http://middlewaremagic.com/weblogic/?p=586

-----------------------------------------------------------------------

---------------
Datasource:
---------------
Click on weblogic console L.H.S > JDBC > Datasources > now feed:
>NAME- Name of JDBC Datasource

>JNDI Name- Enter JNDI absolute path to where this JDBC datasource will be bound.
NOTE: You can specify multiple names seperated by semi-colons (;)

>**CONNECTION POOL- Select the connection pool to which the datasource will point. Application gets the connection from the underlying connection pool by looking up the datasource on the JNDI tree and then requesting a connection from the datasource. The pool you select will be used to provide the connection when application requests for a connection from this datasource.

>**Select the servers and clusters on which you want to deploy the new datasource. You should deploy the datasource to the same servers and cluster on which the underlying connection pool is deployed.

-----------------------------------------------------------------------

Q) JDBC Thin Drivers?
Ans:  These are pure java drivers.
>This is a type4 driver
>This is easy to install
>It is used if java applets are being used
>This driver must be used until and unless there is some specific requirement of the application team.

These are pure java drivers i.e thin drivers i.e This driver  directly converts the java statements to SQl Statements . It wont convert to JDBC statement.
>This is easy to install
>It is used if java applets are being used
>This driver must be used untill and unless there is some specific requirement of the application team.


FLOW:
JAVA--->SQLStatement--->Database(s)

EXAMPLE-
-WebLogic jDrivers for Microsoft SQL Server
-Third-party drivers, including- Oracle Thin and Oracle Thin XA drivers

Q) How to add 3rd party drivers with Weblogic?
Ans: There are 2 ways to do this:
1.Here we need to put the required 3rd party JDBC driver's librarires and jars inside: WL_HOME\server\lib along with weblogic.jar, so that they are loaded when  weblogic.jar is loaded (when the server starts). Therefore, NOW, you DO NOT need to add these JDBC drivers to your CLASSPATH + Install the driver on Weblogic console.
2.If you plan to use a third-party JDBC driver that is not installed with WebLogic Server then here:
You must install the driver on weblogic console + Update your CLASSPATH with the absolute path of of your driver files (i.e driver's libraries and jars) + PATH with  the absolute path of database client files i.e DB client's executables files (i.e .bin/ .exe etc)

Q) Difference between CLASSPATH and PATH?
Ans: CLASSPATH contains the absolute path of the required libraries and jars while the PATH contains the absloute path of required executable file like .bin/ .exe etc.

Q) Difference between XA and non-XA drivers?
Ans:
A non-XA transaction always involves just one resource (local transaction).
NOTE: Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database.

XA= Global transaction ( i.e that may span across multiple resources within one single transaction)
NOTE:
XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources
(Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say  "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.


Q ) Node Manager
Node manager is a weblogic server utility that enables you to start, shut down, and restart administration server and managed server instances from a remote location (weblogic console).
There are two types of Node manager . 1)Java-Based Node manager 2)Script-Based Node manager.
Java-Based Node manager:
Java-based Node manager runs within a Java Virtual Machine (JVM) process.
It is recommended that you run it as a Windows server and VBox UNIX platforms.
Script-Based Node manager:
For UNIX and Linux systems, Weblogic Server provides a script-based version of Node manager.


The following are the important configuration files is Node manager.

Nodemanager.properties:
This is the configuration file used by the Java-based version of Node manager.
This file is located in WL_HOME/common/nodemanager.

startup.properties:
Each Managed server instance has its own startup.properties file with properties that control how Nodemanager starts up and controls the server.
Nodemanager automatically creates this file by using properties passed to Nodemanager when the
Administration Server was last used to start the server.
This allows a Nodemanager client or startup scripts to restart a Managed server using the same
properties last used by the Administration Server.

Nodemanager.domains:
This file contains mappings between the names of domains managed by Nodemanager and their corresponding directories.
This file is located in WL_HOME/common/nodemanager.

nm_data.properties:
This file stores the encryption data the Nodemanager uses as a symmetric encryption key.
This file is located in WL_HOME/common/nodemanager.

nm_password.properties:
This file stores the Nodemanager username and password.
This file is located in DOMAIN_HOME/config/nodemanager.
boot.properties:
Nodemanager uses this file to specify user credentials when starting a server.
This file is located in DOMAIN_HOME/servers/server_name/data/nodemanager.

Node Manager: Common Problems and Resolutions

--------------------------------------------------------
Error: NodeManager is not reachable issue:
--------------------------------------------------------
see: http://middlewaretimes.blogspot.in/2014/02/nodemanager-not-reachable.html
STEPS to start Admin server using Node manager via WLST:
--------------------------------------------------------------------------------
1. Set the java environment using SetDomainEnv.sh
2. java   weblogic.WLST
3.nmConnect('weblogic','weblogic','localhost','5556','7001_Domain')
4.nmStart('AdminServer')
5.nmServerStatus('AdminServer')



Q) HTTP TUNNELING:
Http tunneling is encapsulating other protocols within http protocol.
Usually done when you need to go through a firewall because it only lets http to go through.

Commonly known error:
ERROR: HTTP Client Login: Login rejected with code: 'failed',
REASON: java.net.rjvm.http.HTTPserverJVMConnection.acceptJVM Connection.
CAUSE: If you are trying to access WLS admin console via SSH tunnel OR through network interface that the admin server is NOT listening on, then, weblogic will throw this exception. SOLUTION: Enable http tunneling through console by setting the 'Admin server'> Click on Protocol Tab > Click on Https sub tab.few Debug parameters:

  • DebugHttp
  • DebugHttpLogging
  • DebugtunnelingConnection

Http tunneling is encapsulating other protocols within http protocol.
Usually done when you need to go through a firewall because it only lets http to go through.

HTTP tunneling provides a way to simulate a stateful socket connection between WebLogic Server and a Java client when your only option is to use the HTTP protocol. It is generally used to tunnel through an HTTP port in a security firewall. HTTP is a stateless protocol, but WebLogic Server provides tunneling functionality to make the connection appear to be a regular T3Connection. However, you can expect some performance loss in comparison to a normal socket connection.

Configuring the HTTP Tunneling Connection
Under the HTTP protocol, a client may only make a request, and then accept a reply from a server. The server may not voluntarily communicate with the client, and the protocol is stateless, meaning that a continuous two-way connection is not possible.

WebLogic HTTP tunneling simulates a T3Connection via the HTTP protocol, overcoming these limitations. There are two attributes that you can configure in the Administration Console to tune a tunneled connection for performance. It is advised that you leave them at their default settings unless you experience connection problems. These properties are used by the server to determine whether the client connection is still valid, or whether the client is still alive.


Note:
>HTTP tunneling is disabled by default.
>The server must also support both the HTTP and T3 protocols in order to use HTTP tunneling.

Tunneling Client Ping
When an HTTP tunnel connection is set up, the client automatically sends a request to the server, so that the server may volunteer a response to the client. The client may also include instructions in a request, but this behavior happens regardless of whether the client application needs to communicate with the server. If the server does not respond (as part of the application code) to the client request within the number of seconds set in this attribute, it does so anyway. The client accepts the response and automatically sends another request immediately.

Default is 45 seconds; valid range is 20 to 900 seconds.

Tunneling Client Timeout
If the number of seconds set in this attribute have elapsed since the client last sent a request to the server (in response to a reply), then the server regards the client as dead, and terminates the HTTP tunnel connection. The server checks the elapsed time at the interval specified by this attribute, when it would otherwise respond to the client's request.

Default is 40 seconds; valid range is 10 to 900 seconds.



JMS (Java Messaging Service)
This is used for ASYNCHRONOUS Communication.

JMS Server:
A JMS server acts as a management container for resources within JMS modules. Some of its responsibilities include the maintenance of persistence and state of messages and subscribers. A JMS server is required in order to create a JMS module.

JMS Module:
A JMS module is a definition which contains JMS resources such as queues and topics.

Queues and Topics:
Are the modes of communication i.e one to one and one to many respectively.

Subdeployment:
A subdeployment is a mechanism by which JMS module resources (such as queues, topics, and connection factories) are grouped and targeted to a server resource (such as JMS servers, server instances, SAF agents, or a cluster). This called advanced targeting.

Connection Factory:
A connection factory is a resource that enables JMS clients to create connections to JMS destinations. (This allows JMS clients to connect to JMS destinations)

STEPS OF CREATION:

1. Create a JMS Server
Services > Messaging > JMS Servers
TARGET: Managed server/ Cluster

2. Create a JMS Module
Services > Messaging > JMS Modules
TARGET:JMS module is targetted on a JMS server.
NOTE: While we create a JMS module, it asks for-- “Would you like to add resources to this JMS system module” unchecked/checked, and then press Finish .

3. Create a JMS Queue/ Topic
Services > Messaging > JMS Modules
TARGET:
Stand-alone queues and topics ONLY JMS server
Distributed queues and topics Subdeployment

4.Create Subdeployment 
Services > Messaging > JMS Modules
TARGET: Managed server/ cluster/ JMS server (Banjara)

5.  Create a Connection Factory
Services > Messaging > JMS Modules
TARGET:
FOR DEFAULT TARGETING Managed server or cluster and not on Subdeployment (as per ORACLE recommendations)
FOR ADVANCED TARGETING Subdeployment.


NOTE:

  • JMS servers are targetted to either- JMS servers/ Managed servers/ Cluster.
  • These JMS servers acts as management containers for Topics and queues. A JMS server's primary responsibility is to maintain the information (persistent messages) that arrive on destination.
  • STANDALONE queues/ Topics can ONLY be targeted to a single JMS server.... Whereas... connection factories, foreign servers can be targeted to more than one JMS servers OR to more than one managed server OR a cluster.


JMS SAF (JMS Store and Forward agent):
WLS SAF service is used to provide highly available JMS message production.

Few debug parameters related to JMS:

  • Debug JMSBackEnd/ DebugJMSFrontEnd
  • DebugJMSBoot
  • DebugJMSModule


JMS Modules are of 2 types:
1.System module (Weblogic admin can create this)
2.Application module (This is created by application team)

NOTE:
Application team decides that JMS module will be of which type - System or Application.



LOG FILE AND OUT FILE:

OUT FILE:
> .out file is generated everytime the server is restarted.
> .out file contains less logging as compared to .log file.
> .out file contains the standard output.

LOG FILE:
> Log file is not generated everytime the server is retsarted.
> Application logging goes inside the .log file


Q) PLUGIN WITH WEBLOGIC
see more : http://middlewaretimes.blogspot.in/2014/03/oracle-weblogic-server-how-to-configure.html
-------------------------------------------------------------
Configuring the Apache HTTP Server Plug-In:
-------------------------------------------------------------

After installing the plug-in in the Apache HTTP Server, configure the WebLogic Server Apache Plug-In and configure the server to use the plug-in. This section explains
how to edit the Apache httpd.conf file to instruct the Apache server to load the WebLogic Server library for the plug-in as an Apache module, and to specify the
application requests that should be handled by the module.

Editing the httpd.conf File

Edit the httpd.conf file in your Apache HTTP server installation to configure the Apache HTTP Server Plug-In.

This section explains how to locate and edit the httpd.conf file, to configure the server to use the WebLogic Server Apache Plug-In, to proxy requests by path or by
MIME type, to enable HTTP tunneling, and to use other WebLogic Server plug-in parameters.

Open the httpd.conf file.
The file is located at APACHE_HOME\conf\httpd.conf (where APACHE_HOME is the root directory of your Apache HTTP server installation). See a sample httpd.conf file at
Setting Up Perimeter Authentication.

Ensure that the WebLogic Server modules are included for Apache 2.0.x, manually add the following line to the httpd.conf file:
LoadModule weblogic_module   modules\mod_wl_20.so
Add an IfModule block that defines one of the following:
For a non-clustered WebLogic Server:

The WebLogicHost and WebLogicPort parameters.

For a cluster of WebLogic Servers:

The WebLogicCluster parameter.

For example:

 <IfModule mod_weblogic.c>
  WebLogicHost myweblogic.server.com
  WebLogicPort 7001
</IfModule>
 To proxy requests by MIME type, add a MatchExpression line to the IfModule block. Note that if both MIME type and proxying by path are enabled, proxying by path takes
precedence over proxying by MIME type.
For example, the following IfModule block for a non-clustered WebLogic Server specifies that all files with MIME type .jsp are proxied:

 <IfModule mod_weblogic.c>
  WebLogicHost myweblogic.server.com
  WebLogicPort 7001
  MatchExpression *.jsp
</IfModule>
You can also use multiple MatchExpressions, for example:

 <IfModule mod_weblogic.c>
  WebLogicHost myweblogic.server.com
  WebLogicPort 7001
  MatchExpression *.jsp
  MatchExpression *.xyz
</IfModule>
If you are proxying requests by MIME type to a cluster of WebLogic Servers, use the WebLogicCluster parameter instead of the WebLogicHost and WebLogicPort parameters.
For example:

 <IfModule mod_weblogic.c>
  WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
  MatchExpression *.jsp
  MatchExpression *.xyz
</IfModule>
 To proxy requests by path, use the Location block and the SetHandler statement. SetHandler specifies the handler for the Apache HTTP Server Plug-In module. For
example the following Location block proxies all requests containing /weblogic in the URL:
 <Location /weblogic>
  SetHandler weblogic-handler
PathTrim /weblogic
</Location>
The PathTrim parameter specifies a string trimmed from the beginning of the URL before the request is passed to the WebLogic Server instance (see General Parameters
for Web Server Plug-Ins).

 Optionally, enable HTTP tunneling for t3 or IIOP.
 To enable HTTP tunneling if you are using the t3 protocol and weblogic.jar, add the following Location block to the httpd.conf file:
 <Location /HTTPClnt>
  SetHandler weblogic-handler
</Location>
 To enable HTTP tunneling if you are using the IIOP, the only protocol used by the WebLogic Server thin client, wlclient.jar, add the following Location block to the
httpd.conf file:
 <Location /iiop>
  SetHandler weblogic-handler
</Location>
 Define any additional parameters for the Apache HTTP Server Plug-In.
The Apache HTTP Server Plug-In recognizes the parameters listed in General Parameters for Web Server Plug-Ins . To modify the behavior of your Apache HTTP Server
Plug-In, define these parameters either:

 In a Location block, for parameters that apply to proxying by path, or
 In an IfModule block, for parameters that apply to proxying by MIME type.
Including a weblogic.conf File in the httpd.conf File

If you want to keep several separate configuration files, you can define parameters in a separate configuration file called weblogic.conf file, by using the Apache
Include directive in an IfModule block in the httpd.conf file:

 <IfModule mod_weblogic.c>
  # Config file for WebLogic Server that defines the parameters
  Include conf/weblogic.conf
</IfModule>
The syntax of weblogic.conf files is the same as that for the httpd.conf file.


This section describes how to create weblogic.conf files, and includes sample weblogic.conf files.

Some imp parameters:

Idempotent (default ON)
When set to ON and if the servers do not respond within WLIOTimeoutSecs, the plug-in fail over. If set to OFF the plug-in do not fail over If  you are using the Netscape Enterprise Server Plug-In, or Apache HTTP Server you can set this parameter differently for different URLs or MIME types.

DynamicServerList (default ON)
WebLogicCluster is only a starting point for the dynamic server list that the server and plug-in maintain This server list is  dynamically updated for every request If set to OFF: The plug-in only uses the static list specified with the WebLogicCluster parameter If one or more servers in the  static list fails, the plug-in could waste time trying to connect to a dead server, resulting in decreased performance. If you add a new server to the cluster, the  plug-in cannot proxy requests to the new server unless you redefine this parameter. WebLogic Server automatically adds new servers to the dynamic server list when they  become part of the cluster.
See more at:
http://middlewaremagic.com/weblogic/?p=654#sthash.99J7B6Dc.dpuf


ConnectTimeoutSecs (default 10 seconds)
Maximum time in seconds that the plug-in should attempt to connect to the WebLogic Server host. Make the value greater than ConnectRetrySecs
If ConnectTimeoutSecs expires without a successful connection, even after the appropriate retries (see ConnectRetrySecs), an HTTP 503 (Service Unavailable) response is sent to the client.

ConnectRetrySecs (default 2 seconds)
Interval in seconds that the plug-in should sleep between attempts to connect to the WebLogic server host ConnectRetrySecs <= ConnectTimeoutSecs
To specify no retries, ConnectRetrySecs = ConnectTimeoutSecs (but the plug-in always attempts to connect at least twice)

KeepAliveSecs (default 20)
The length of time after which an inactive connection between the plug-in and WebLogic Server is closed. You must set KeepAliveEnabled to true (ON when using the Apache plug-in) for this parameter to be effective
The value of this parameter must be less than or equal to the value of the Duration field set in the Administration Console on the Server/HTTP tab, or the value set on  the server Mbean with the KeepAliveSecs attribute.

KeepAliveEnabled  (default ON)
Enables pooling of connections between the plug-in and WebLogic Server.
Valid values for the Apache plug-in are ON and OFF.

WLIOTimeoutSecs (default 300 seconds)
Also known as HungServerRecoverSecs (old name)
Defines the amount of time the plug-in waits for a response to a request from WebLogic Server
The plug-in waits for WLIOTimeoutSecs for the server to respond and then declares that server dead, and fails over to the next server
The value should be set to a very large value. If the value is less than the time the servlets take to process, then you may see unexpected results

USE:
See more at: http://middlewaremagic.com/weblogic/?p=654#sthash.99J7B6Dc.dpuf

--------------------------------------
Q) Iplanet plugin configuration :
--------------------------------------

Step 1). Create a Webserver running on port 8081 using the Admin Console of SunOne.

Step 2). Copy over the plugin present in the following directory
C:\bea103\wlserver_10.3\server\plugin\win\32\proxy61.dll

To the Sun One Installation Directory

C:\Sun\WebServer6.1\plugins\lib

Step 3). Load the plugins by adding the following lines in magnus.conf present in
C:\Sun\WebServer6.1\https-testserver\config

magnus.conf

Init fn=”load-modules” funcs=”wl_proxy,wl_init” shlib=”C:/Sun/WebServer6.1/plugins/lib/
proxy61.dll”

To forward request to a Standalone Server add the following lines to obj.conf file present in
the following directory
C:\Sun\WebServer6.1\https-testserver\config

obj.conf
Service fn=”wl_proxy” WebLogicHost=localhost WebLogicPort=7001 WLLogFile=”C:/Sun/

WebServer6.1/https-testserver/logs/proxy.log” Debug=ALL DebugConfigInfo=ON

To forward request to a CLuster we need to add the following in the bj.conf file
Service fn=”wl_proxy” WebLogicCluster=”localhost:7001,localhost:7003? WLLogFile=”C:/

Sun/WebServer6.1/https-testserver/logs/proxy.log” Debug=ALL DebugConfigInfo=ON


Note:
http://weblogic-wonders.com/weblogic/2010/11/12/configuring-sunone-iplanet-webserver-with-weblogic/
http://docs.oracle.com/cd/E23943_01/web.1111/e16435/iplanet.htm


----------------------------------------------------
Proxy requests by URL (inside iPlanet)):
----------------------------------------------------
## -------------BEGIN SAMPLE obj.conf CONFIGURATION-------------------
# (using a WebLogic Cluster)
#
# Configure which types of HTTP requests should be handled by the
# iPlanet module (and, in turn, by WebLogic). This is done
# with one or more "<Object>" tags as shown below.
# Here we configure the iPlanet module to pass requests for
# "/weblogic" to a cluster of WebLogic Servers.
<Object ppath="*/weblogic/*">
Service fn=wl-proxy WebLogicCluster="myweblogic.com:7001,yourweblogic.com:7001, theirweblogic.com:7001" PathTrim="/weblogic"
</Object>
# Here we configure the plug-in so that requests that
# match "/servletimages/" are handled by the
# plug-in/WebLogic.
<Object name="si" ppath="*/servletimages/*">
Service fn=wl-proxy WebLogicCluster="myweblogic.com:7001,yourweblogic.com:7001, theirweblogic.com:7001"
</Object>
## ----------------END OF SAMPLE obj.conf CONFIGURATION------------------
Proxy requests by MIME types
# This Object directive works by file extension rather than
# request path. To use this configuration, you must modify the existing line or add the following line to mime.types file.:
## -----------------BEGIN SAMPLE mime.types FILE -------------------------
# type=text/jsp exts=jsp
#
## --------------------END SAMPLE mime.types------------------------------

## -------------BEGIN SAMPLE obj.conf CONFIGURATION-----------------------
# This configuration means that any file with the extension
# ".jsp" is proxied to WebLogic. Then you must add the
# Service line for this extension to the Object "default",
# which should already exist in your obj.conf file:
<Object name=default>
NameTrans fn=pfx2dir from=/ns-icons dir="c:/Export/Home/ns-icons"
NameTrans fn=pfx2dir from=/mc-icons dir="c:/Export/Home/ns-icons"
NameTrans fn="pfx2dir" from="/help" dir="c://Export/Home/manual/https/ug"
NameTrans fn=document-root root="c://Export/Home/docs"
Service method="(GET|HEAD|POST|PUT)" type=text/jsp fn=wl_proxy WebLogicCluster="myweblogic.com:7001, yourweblogic.com:7001,
theirweblogic.com:7001",PathPrepend=/jspfiles
PathCheck fn=nt-uri-clean
PathCheck fn="check-acl" acl="default"
PathCheck fn=find-pathinfo
PathCheck fn=find-index index-names="index.html,home.html"
ObjectType fn=type-by-extension
ObjectType fn=force-type type=text/plain
Service method=(GET|HEAD) type=magnus-internal/imagemap fn=imagemap
Service method=(GET|HEAD) type=magnus-internal/directory fn=index-common
Service method=(GET|HEAD) type=*~magnus-internal/* fn=send-file
AddLog fn=flex-log name="access"
</Object>
# The following directive enables HTTP-tunneling of the
# WebLogic protocol through the NES plug-in.
<Object name="tunnel" ppath="*/HTTPClnt*">
Service fn=wl-proxy WebLogicCluster="myweblogic.com:7001, yourweblogic.com:7001, theirweblogic.com:7001"
</Object>
#
## -------------END SAMPLE obj.conf CONFIGURATION--------------------



------------------
Q) Plugin with iis:
------------------
This is a simple example of Configuring IIS(running on default port 80) on Weblogic Server. Create two Weblogic Servers running on Port 7001 and 7003, create a Cluster and add the two Servers to the Cluster. Deploy an application on the Cluster and after the configuration on ISS, access the application as
http://localhost/myApp
Step-1). Make a directory on the IIS box for the plug-in.
For instance: c:\Inetpub\WLS_IIS_Plugin\
Step-2). Copy iisforward.dll and iisproxy.dll to this new directory. These files are located at:
10.0: \wlserver_10.0\server\plugin\win\32
10.3: \wlserver_10.3\server\plugin\win\32
Step-3).To install iisforward.dll as an ISAPI filter, do the following:
a). Go to Start->Administrative Tools->Internet Information Services (IIS) Manager
b). In the left pane, go to the active website (like “Default Web Site”) Right-click the active website and select Properties
c). Select the ISAPI Filters tab and press the Add button Filter name: WLS IIS Plugin (Or whatever you want)
d). Executable: C:\Inetpub\WLS_IIS_Plugin\iisforward.dll (Or whatever path you created)
e). Press OK twice, IIS6 does not allow the iisforward.dll ISAPI Extension to run by default.
To enable:
In the left pane of the Internet Information Services (IIS) Manager,click on Web Service Extension (located under the computer name)
In the right pane, highlight All Unknown ISAPI Extensions and press
the Allow button
Step-4).To map .wlforward to use iisproxy.dll, do the following:
a). In the left pane, drill down to the active website (like “Default Web Site”)
b). Right-click the active website and select Properties
c). Select Home Directory tab
d). Click the Configuration… button.
e). In the Application Mapping tab, click the Add… button.
i). Executable: C:\Inetpub\WLS_IIS_Plugin\iisproxy.dll
ii). Extension: .wlforward
f). Uncheck Verify that file exists
g). IMPORTANT: Ensure .wlforward is *not* mapped to iisforward.dll. While this seems intuitive, it is wrong. .wlforward maps to iisproxy.dll.
h). Press OK three times
i). Exit the IIS Manager MMC console.
Step-5).Create a text file named iisproxy.ini and place it in the plug-in directory (e.g. c:\Inetpub\WLS_IIS_Plugin\iisproxy.ini)
“iisproxy.ini”
————————-
WebLogicCluster=localhost:7001,localhost:7003
WlForwardPath=/
Debug=ALL
DebugConfigInfo=ON
WLLogFile=c:/temp/iisproxy.log
————————-
Step-6).Restart IIS using the following CLI statement: iisreset /restart
Step-7).Use a browser to access IIS. This will ‘turn on’ the IIS->WLSISAPI filter.
Step-8).Relaunch the IIS Manager and check the ISAPI filter tab to ensure the iisforward.dll is now ‘turned on’, as evidenced by a green arrow.


Q) TOTAL NUMBER OF PORTS ON A PHYSICAL SERVER:
There are total 65536 ports ( 0 To 65535)

The port numbers are divided into three ranges:
1.The Well Known Ports- The Well Known Ports are those from 0 through 1023.
2.The Registered Ports- The Registered Ports are those from 1024 through 49151
3.The Dynamic and/or Private Ports- The Dynamic and/or Private Ports are those from 49152 through 65535

----------------------------------------------------------
Q) Well Known Port Numbers with description:
----------------------------------------------------------
1 TCP Port Service Multiplexer (TCPMUX)
5 Remote Job Entry (RJE)
7 ECHO
18 Message Send Protocol (MSP)
20 FTP -- Data
21 FTP -- Control
22 SSH Remote Login Protocol
23 Telnet
25 Simple Mail Transfer Protocol (SMTP)
29 MSG ICP
37 Time
42 Host Name Server (Nameserv)
43 WhoIs
49 Login Host Protocol (Login)
53 Domain Name System (DNS)
69 Trivial File Transfer Protocol (TFTP)
70 Gopher Services
79 Finger
80 HTTP
103 X.400 Standard
108 SNA Gateway Access Server
109 POP2
110 POP3
115 Simple File Transfer Protocol (SFTP)
118 SQL Services
119 Newsgroup (NNTP)
137 NetBIOS Name Service
139 NetBIOS Datagram Service
143 Interim Mail Access Protocol (IMAP)
150 NetBIOS Session Service
156 SQL Server
161 SNMP
179 Border Gateway Protocol (BGP)
190 Gateway Access Control Protocol (GACP)
194 Internet Relay Chat (IRC)
197 Directory Location Service (DLS)
389 Lightweight Directory Access Protocol (LDAP)
396 Novell Netware over IP
443 HTTPS
444 Simple Network Paging Protocol (SNPP)
445 Microsoft-DS
458 Apple QuickTime
546 DHCP Client
547 DHCP Server
563 SNEWS
569 MSN
1080 Socks

USE: http://www.webopedia.com/quick_ref/portnumbers.asp

PERFORMANCE TUNING(Jrockit JDK)
See : http://middlewaretimes.blogspot.in/2014/08/jvm-memory-monitoring-tuning-garbage.html
See: http://middlewaretimes.blogspot.in/2014/08/jvm-crash-javalangoutofmemoryerror.html


PERFORMANCE TUNING(Sun JDK):

OOM comes due to following issues:
1.Heap
2.Native
3.Perm Gen (If its Sun JDK) // TLA if it is JRockit
4.Due to large object
5.Swap space

NOTE:
Heap can be allocated at max at 75% of RAM.

------------
1.HEAP:
------------
If OOM comes due to heap space, then we need to increase the heap space (Xms and XMX values). It is always recommended as ORACLE's beat practice to keep both the Xms and Xmx at the same values. By allocating Xms= Xmx it ensures that the heap is reserved and no other process can interrupt in the heap space and the application has to wait till that process does not finish.


------------
2.Native:
------------
ERROR: java.lang.out of memory Error: Unable to create new Native thread.
SOLUTION:
1.Decrease the heap space.

2.Check for ulimit –a
ulimit and sysctl programs allow to limit system-wide resource use
ulimit -u 30 : this way we can set ulimit
ulimit -a : this lists current setting

If we see that there are too many open files, then we need to ask our UNIX team to increase the ulimit.

3.Set kernel parameter max dsize to a higher value  by contacting your Unix team.

4.Need to reduce the JVM Stack Size and the O.S size both. Set the -Xss (i.e java stack size) in java options and set ulimit -S on O.S level by contacting your unix team.

-------------------------------------------
3.(A)Perm gen: (If it is Sun JDK)
-------------------------------------------
This is set to 1/3rd or 1/4th of the heap space as the ORACLE's best practices.

ERROR: java.lang.OutofMemory Error: Perm gen.
SOLUTION: Increase the max perm gen space i.e  -xx:MaxPermSize=256m

There can be a leak in the perm gen objects. If tuning parameters do not resolve the issue, we need then need to use the memory leak detector tools and find out which  instances in the perm gen space are not getting cleared.

Q)  Example of memory leak detector tool and how to use it?
Ans:

-----------
(B)TLA:
-----------
ERROR: java.lang.outOfMemory Error: NativeGetNewTLA
SOLUTION: set and tune the TLA size (as XXtlasize:128)

----------------------------------------------------------
4.OOM can be due to large object allocation:
----------------------------------------------------------
ERROR: java.lang.OutOfMemoryError: allocLargeObjectArray -Object size:372032, Num elements:372012
SOLUTION:  set the  -XXlargeObjectlimit: 128k


---------------------------
5.Due to Swap space:
----------------------------
Swap space= 2 * Heap space (ORACLE's best practices)


WLS HANG:

WLS hang occurs due to one of the following mentioned reasons:
1.WLS trying to establish a connection with DB, but it is not happening.
2.Due to network outage.
3.Some thtread is holding an object, AND some other thread is trying to hold the same object, since the 1st thread is not releasing the lock, then in such scenarios appplication goes on a hung state.

In such scenarios we need to take the thread dump.

ERROR: Stuck threads
SOLUTION: Take thread dumps 5-7 sets in an interval of 8-12 seconds.


THREAD DUMP:
----------------------------------
How to take thread dump:
----------------------------------
In case of WLS hang or OOM we need to trace the threads and we need to take thread dumps. And for this we need to use the following command:
Kill -3 pid (5 to 7 sets in an interval of 10-12 seconds)

This dump will utomaticall go in .out file

Sequence of commands:
1) cp 1.out 2.out
2) >1.out (This will empty the existing 1.out file)
3) Now kill -3 pid (5 to 7 sets in an interval of 10-12 seconds)
4) cp 1.out 3.out
5) Now restart the WLS , so, a fresh .out gets generated

Commonly used tools used for thread dump analysis are:
1.Samurai
2.IBM thread dump analyzer


Here we need to download samurai.exe fike from internet and then we need to double click on it.
It will open up wherein we need to drag and drop the .out file.
Here we need to analyze the application related (i.e default threads) which is tuck and  has got the lowest thread id.
Once we click on this thread (in tabular format area), it will take you to detail thread stack trace. This stuck thread which has the lowest thread id is the culprit
thread and we need to check this thread for root cause analyis. Also we need to send this thread dump to our application team.

Here we need to make it sure that the resources which are needed at runtime are available otherwise the thread will hang and thus WLS will hang.

-----------------------
Types of threads:
-----------------------
1.Muxer threads
2.Execute threads
3.Application/ Default threads

1.Muxer threads:
Are socket related threads and these are always busy in accepting the requests which are coming to WLS and replying the same request.

2.Execute threads:
These are WLS threads which are used for processing the requests. We generally do not analyze them.

3.Application/ Default threads:
These are the threads which we analyze.

GARBAGE COLLECTION:
There are 2 Strategies of Garbage collection:

------------------------------------
1.Concurrent and GenCon:
------------------------------------
>>Concurrent= Full G.C happens AND the application stops for few milli seconds.
>>Generational Concurrent= G.C in Young Generation + FULL G.C AND the application stops for few milli seconds.

-----------------------------
2.Parallel and GenPar:
-----------------------------
>>Parallel= Full G.C happens AND the application does not stop.
>>Generational Parallel= G.C in Young Generation + FULL G.C AND the application does not stops.


Q) Where to Define these startegies?
Ans-inside JAVA Options

Q) By default which startegy is taken by JVM
AnsThere is no by default strategy.
JVM by default invokes GC by itself  and invokes the strategy which is defined inside JAVA options ( i.e either inside startup script or setDomainEnv.sh or setWlsEnv.sh )
GC algorithms are- like Mark&Sweep, wherein the objects which are no longer in use are moved from YOUNG generation to OLD generation.

Q) Where to define?
Ans- inside java options

Q) How to trigger GC?
Ans-
1.(Forcefull) GC via Weblogic console.login to admin console
2. On left hand side, select Environment -> your server for which you want to perform  GC
3. On right hand side select Monitoring -> Performance

Q) How to ANALYZE the GC.logs and define the parameters to for GC loging?
Ans-It’s always best to enable the Garbage collection Logging in our production environment as well because it does not cause any resource overhead or any side effect on weblogic server or an other application server’s performance.
GC log helps us in investigating man issues. Apart from issues it helps us to find out if some tuning is required based on the statistics of the Garbage collection. .

Garbage collection logging can be enable and collected in a separate log file by using the following JAVA_OPTIONS:
-Xloggc:D:/gcLogs/GCLogs.log    
-XX:+PrintGCDetails    
-XX:+PrintGCTimeStamps
As soon as you add these JAVA_OPTIONS which are JVM specific (above will work for Sun and Open JDKs fine) the JVM will start generating the garbage collection logging in the GCLog.log file.

You can notice something in the above output:

Point-1). [Full GC (System) [PSYoungGen: 38388K->0K(268800K)]    It means a Full GC is happening on the complete Heap Area including all the Areas of the Java Heap Space.
Point-2). [GC [PSYoungGen: 230400K->19135K(268800K)]   Indicates some small GCs which keep on happening in the young generation very frequently,This garbage collection cleans the Young Generation short living Objects. .
Point-3). Meaning of the [GC [PSYoungGen: 230400K->19135K(268800K)]   line is around 256MB (268800K) is the Young Generation Size, Before Garbage Collection in young generation the heap utilization in Young Generation area was around  255MB (230400K)  and after garbage collection it reduced up to 18MB (19135K) .
Point-4). Same thing we can see for Full Garbage collection as well….How effective the Garbage collection was…[Full GC (System) [PSYoungGen: 38388K->0K(268800K)]
[PSOldGen: 13545K->51794K(1789952K)]  Here it says that around [(old)1789952K +  young (268800K) ]  memory space means  OldGeneration is consuming 1.75GB space and
Young Generation is consuming around 255 MB space.  So it means total Heap size is around 2GB.

----------------------------------------------------------------------------------------
Using GarbageCat tool for analysing the GC  (garbagecat-1.0.0.jar ):
----------------------------------------------------------------------------------------
But analyzing the Garbage collection log like above technique Line by Line is very bad…so here we have an alternative was to analyze the Garbage Collection log in few
Seconds to see how much time the Full Garbage collection is taking as an average and other reports…etc.

Step1). Download the “garbagecat-1.0.0.jar   (881 KB) ”  tool from the follwing link:
http://garbagecat.eclipselabs.org.codespot.com/files/garbagecat-1.0.0.jar

Step2). Open a command prompt and then make sure that JAVA is set in the Path so that we can use “jar” utility of JDK to run the “garbagecat-1.0.0.jar”  tool.

Step3). Put the “garbagecat-1.0.0.jar”  file and the “GCLog.log” file in the same directory. then run the following command:
java      -jar      garbagecat-1.0.0.jar      GCLog.log

Step4). As soon as ou run the above command you will see that in your current directory following files are created:
garbagecat-1.0.0.jar
GCLog.log
gcdb.lck
gcdb.log
gcdb.properties
report.txt

Step5). Now open the “report.txt” file to see the Over all report of the Garbage Collection something like following:
========================================
SUMMARY:
========================================
# GC Events: 12
GC Event Types: PARALLEL_SCAVENGE, PARALLEL_SERIAL_OLD
Max Heap Space: 2058752K
Max Heap Occupancy: 462018K
Max Perm Space: 39936K
Max Perm Occupancy: 19868K
Throughput: 95%
Max Pause: 306 ms
Total Pause: 1233 ms
First Timestamp: 4636 ms
Last Timestamp: 24449 ms
========================================
.
If you see that the Garbage Collection Max Pause time is very high like  more than 5-7 Seconds then either we need to:
1.change thegarbage collection startegy or
2.need to tune the GC parameters and
3.JVM (Heap size, RAM Size, Swap Space, Pergen (if Sun JDK), TLA (if Jrockit) tuning needs to be done.


Q) Commonly know Erros related to GC?
Ans- out of memory :java heap space, out of memory:perm gen space, out of memory :unable to create native thread

Q) GC tuning parameters?
Ans- GC tuning is done through performance tuning parameters.

USE:-
http://middlewaremagic.com/weblogic/?p=4464
http://middlewaremagic.com/weblogic/?p=4500----JVM



HEAP DUMP AND ITS ANALYSIS USING Jmap AND Jhat RESPECTIVELY:
Here is a Simple Demonstration of using JMap to Generate the Binary heap Dump…Which we will analyze later using Jhat tool. These tools are very common and freely available for Download porpose. But from Sun JDK 1.6 Onwards it is by default available inside “<JAVA_HOME>\bin” directory.

What is Jmap And Why Not Jhat?
>Jmap is much better than Jhat utility because to start with Jmap utility u need not to apply any JAVA_OPTION on the WebLogic Server … you can directly start with any  WebLogic Server which is Running on Sun JDK …. All u need to do is …Just find the Process ID of that WLS Server…thats all.

>Jmap generates the Heap Dump Much faster than Jhat.

>Jhat HeapDumps sometimes are seen as currupted file…But jmap is more reliable and generates the correct Heap Dump file. (correct heap dump generation percentage wise it is better than Jhat)

----------------------------------------------------------------
STEPS to generate Heap dump using Jmap in UNIX:
----------------------------------------------------------------
Step1). Start a Weblogic Server instance normally on your Local Machine and then find the Process ID (PID).

Step2). If you are using Unix Based Operating System then u can find out the Process ID (PID) by running the following Command:
ps -ef | grep java (or managed server name)

----------------------------------------------------------------------------------------------------
If you are using WINDOWS then follow the below Steps to find out the Process ID (PID):
----------------------------------------------------------------------------------------------------
a) Press “Ctrl+Alt+Del” 2 buttons together.
b) Press the “Task Manager” Button
c) Click on “Processes” Tab.
d) Now Select the Menu Item “View” — > “Select Columns”
e) Check the “PID (Process Identifier)” Check box as well…
f) Now u can see the Process Id of “java.exe” in the “Processes” Tab.


Step3).Start the “JMap” tool from “<JAVA_HOME>\bin” directory as following:
C:\bea103\jdk160_05\bin>jmap -dump:format=b,file=heapJMap.bin 7540

Note:
use:  -J-d64 jvm option if your JVM is 64 Bit Jvm “jmap    -J-d64 -heap     pid”

Step4). To Read the Binary Heap Dump File … Jhat is one of the Best Tool… Please run the following command to inoke the “jhat” tool Http Server by passing the Heap
Dump File name…
C:\bea103\jdk160_05\bin>jhat -J-mx1024m heapJMap.bin

Step5).Now open a Web Browser with the following URL: “http://localhost:7000? - See more at: http://middlewaremagic.com/weblogic/?p=2241#sthash.fjv9RXSB.dpuf


Here the Jhat tool will display the following 3 info in histogram (i.e tabular type) format:
1.Name of classes (e.g: class char[], class.java.lang.String, class.java.util.HashMap, class.java.lang.Object[])
2.Class's instance count
3.Size of these instances
**instances= objects

JMAP options
-histo
Prints histogram on command line interface/putty
-finalizerinfo
Prints information on objects awaiting finalization.
-heap
Prints a heap summary. GC algorithm used, heap configuration and generation wise heap usage are printed.
-permstat
Prints class loader wise statistics of permanent generation of Java heap
- See more at: http://middlewaremagic.com/weblogic/?p=2241#sthash.fy9J6Ctd.dpuf


Use:
http://middlewaremagic.com/weblogic/?p=2241  (generating heap dump from jmap and analysing through jhat)
-----------------------------------------------------------------------
Heap dump generation and analysis through Jhat

Jhat tool comes free and available inside the “<JAVA_HOME>\bin” directory (from JDK1.6 onwards only). If you are using Jdk 1.5 or Lower version then u need to  separately download the Jhat tool.from  “https://hat.dev.java.net/”

Step1). Open the “startWebLogic.sh”(Unix Based OS) or “startWebLogic.cmd”(Windows OS)  and then add the JAVA_OPTIONS
set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% --Xrunhprof:format=b,file=MyHeapDump.hprof

Step2). Now restart Your Server. As soon as you will start your Server you will find that “MyHeapDump.hprof” file is created inside your <DOMAIN_HOME> root directory:

Step3). Open the HeapDump using the Jhat tool like following:
C:\bea103\jdk160_05\bin>jhat -J-mx1024m  C:\bea103\user_projects\domains\WS_Security_Domain\MyHeapDump.hprof
OR
place the file in some other location before opening it…
C:\bea103\jdk160_05\bin>jhat      -J-mx1024m       C:\myHeapDumps\MyHeapDump.hprof
Step4). As soon as u run the Obove command jhat tool starts a Http Server on default port 7000…Please open a browser with the following URL: http://localhost:7000 -

Step5). Object Query Language (OQL) OQL is SQL-like query language to query Java heap. OQL allows to filter/select information wanted from Java heap. While pre-defined queries such as “show all instances of class X” are already supported by JHAT

Browse: http://localhost:7000/oql/


USE:
http://middlewaremagic.com/weblogic/?p=2202  (generating and analysing heap dump from jhat)

1 Comments