Monday, September 17, 2018

Recover password from .sth file

Create perl file (unstash.pl) and run the script.

#!/usr/bin/perl

#usage perl unstash.pl

use strict;

die "Usage: $0 \n" if $#ARGV != 0;

my $file=$ARGV[0];
open(F,$file) || die "Can't open $file: $!";

my $stash;
read F,$stash,1024;

my @unstash=map { $_^0xf5 } unpack("C*",$stash);

foreach my $c (@unstash) {
   last if $c eq 0;
   printf "%c",$c;
}

Monday, September 10, 2018

How to deploy or uninstall ear using command line Jython script in Websphere

Cognizant Latest Interview Questions

http://webspherelife.blogspot.com/2016/10/cognizant-interview-questions-websphere.html

This tutorial covers about how to deploy , start , stop , uninstall an application in websphere application server (WAS) using the command line tool wsadmin with Jython script. Before that let us see the various administrative tools provided by  WebSphere Application Server for application deployment.

1. admin console
          The admin console is a browser-based Web application running in the Web container to administer WebSphere Application Server.  This  console uses Simple Object Access Protocol (SOAP) via HTTP or HTTPS to connect to the admin application in the application server or deployment manager.

2. wsadmin  (WebSphere scripting client )
                             It is a command line tool that is a non-graphical scripting interface that can be used  to administer WebSphere Application Server from a command line prompt. It  accepts a file of scripted commands or which  can be run interactively.     For scripting, wsadmin supports the two script languages JACL and jython.   .

3. ANT (Another Neat Tool )
                         You can create build scripts that compile, package, install, and test your application on WebSphere Application Server.
                    Although the admin console is easy to use and sufficient for tasks that are simple , non-repetitive and having  a minimal number of administrative steps.   For administrative task that requires many steps, which can be repetitive, and also time consuming  , wsadmin is the right tool.   wsadmin   accepts a file of scripted commands or  which can be run interactively.  For scripting, wsadmin supports  two script languages JACL and jython.  WebSphere Application Server installation has a bin directory that contains the wsadmin command .  The default connection  of wsadmin to  connect to the Mbeans is SOAP with the default port 8879. You can also start wsadmin with the different port with -port argument

   Now let us see the steps for deploying  an  application (ear)  using command line tool wsadmin with  Jython script.    The simplest deployment scenario is to deploy an application from a desktop  to a  running base server.

Steps :
    Start the application server if the application server is not running

 Open a command prompt and change to the application_server_profile_root/bin directory

To check the status of the server

    serverStatus.sh server1  

If the server  is stopped , then start the server with the below command

    startServer.sh server1

a)  Save the below lines written using  jython script  in a file (for example : deploy.jython)

earLoc='path and filename of your ear file'     #eg. '/root/Desktop/sales.ear'

appName='your application name'                # eg. 'salesWeb' 

cellName=AdminControl.getCell()

nodeName=AdminControl.getNode()

appManager=AdminControl.queryNames('cell='+cellName+',node='+nodeName+',type=ApplicationManager,process=server1,*')

print appManager

#AdminControl.invoke(appManager , 'stopApplication',appName)

print AdminApp.uninstall(appName)

AdminConfig.save()

print AdminApp.install(earLoc)

AdminConfig.save()

AdminControl.invoke(appManager , 'startApplication',appName) 

b)  Change the first two lines with your suitable values in the script file, save the script file and run it  using the below command that will deploy the ear.

wsadmin.sh -f  script_file -lang jython
e.g. in linux   :    $wsadmin.sh -f deploy.jython -lang jython
e.g. in windows :  app_profile_root\ bin>   wsadmin.bat -f deploy.jython -lang jython

To complete & repeat  the above task using admin console , you have to do many steps every time. But using wsadmin , this task can be repeated any number of times  using the above single line  whenever the application gets modified.

       If the application is already not installed , you may get the error application does not exist . Then you may comment (#) the   below lines in the script file.           
                        print AdminApp.uninstall(appName)
                        AdminConfig.save()

Cognizant Latest Interview Questions
http://webspherelife.blogspot.com/2016/10/cognizant-interview-questions-websphere.html

Monday, September 3, 2018

How to Solve OutOfMemoryError in WAS (WebSphere)

When I upload a big file through java application running on  Websphere Application Server , I got   OutOfMemoryError   , as given below
  JVMDUMP013I Processed Dump Event "uncaught", detail "java/lang/OutOfMemoryError". 
              Also memory leak is  a common memory problem that also leads to OutOfMemory error. In Java ,  memory leaks can not happen as  it has automatic Garbage Collection (GC). GC  removes  unused objects that are not referenced anymore. But if an object is not used, but is still referenced, GC does not remove it, which leads to memory leaks in JVM .
                  Due to the above memory leak or large objects error ,  the performance of the application server may decline or   WAS may be  crashed with OutOfMemory error. . Please check  the error  message  java.lang.OutOfMemoryError”  in the WAS  log file ( i.e. native_stderr.log)

One of Solution to the above error :
          When I increase the JVM Heap Size ,  the problem got solved . Now let us see , how to increase JVM Heap Size in Websphere Application Server

You can solve the problem in two ways
 i) Using the IBM console
 ii) By changing  the server.index file directly

i). To tune the JVM Max Heap size using the IBM console 
        1. Open the WebSphere Application Server administrative console, http://hostname:port/ibm/console, and log in.
        2. Expand Servers  -> Application servers  -> server1  -> Java and Process Management  -> Process Definition  -> Java Virtual Machine.


  3. Change the Max Heap Size to a larger value.


4. Click Apply and click Save .
                     Restart WebSphere Application Server.

ii). By changing  the server.xml file directly

Open the server.xml file located in the following directory

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/YourSrverNode01Cell/nodes/YourServerNode01/servers/server1

You may get the following lines related to JVM entries ...

   <processDefinitions xmi:type="processexec:JavaProcessDef" xmi:id="JavaProcessDef_1268723379271" workingDirectory="${USER_INSTALL_ROOT}" executableTargetKind="JAVA_CLASS" executableTarget="com.ibm.ws.runtime.WsServer" >
     <execution xmi:id="ProcessExecution_1268723379271" processPriority="20" runAsUser="" runAsGroup=""/> <ioRedirect xmi:id="OutputRedirect_1268723379271" stdoutFilename="${SERVER_LOG_ROOT}/native_stdout.log"  stderrFilename="${SERVER_LOG_ROOT}/native_stderr.log"/ >
     <monitoringPolicy xmi:id="MonitoringPolicy_1268723379271" maximumStartupAttempts="3" pingInterval="60" pingTimeout="300" autoRestart="true" nodeRestartState="STOPPED"/ >
     <jvmEntries xmi:id="JavaVirtualMachine_1268723379271" verboseModeClass="false" verboseModeGarbageCollection="false" verboseModeJNI="false" initialHeapSize="250" maximumHeapSize="512" runHProf="false" debugMode="false" debugArgs="-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" disableJIT="false"/ >
   </processDefinitions >

Change the initialHeapSize to new larger value (i.e. 512 or 1024)  and  maximumHeapSize to  new larger value (i.e. 2048)   .  If there is no parameters , you can add the two parameters (initialHeapSize="512" maximumHeapSize="2048") with value after verboseModeJNI="false" . Now save the server.xml file

Note :  Changing the Max Heap Size to very larger value that is more than half of the total RAM ,   may result the following  error when we start the WAS  ,
VMJ9GC028E Option too large: '-Xmx4096m'
JVMJ9VM015W Initialization error for library j9gc23(2): Failed to initialize, parsing command line
Could not create the Java virtual machine.

Then  you have to reduce the  max heap size value using the IInd method ..(i.e. change server.xml file directly)

Tuning the max heap size
  Setting the JVM heap size directly relates to the number of server instances need to be  started on a specific node and the total RAM available on that machine. The total value of all server JVM heap sizes on a specific node must be less than half of the total RAM of that computer. To determine the max heap size , you can use the following equation
max_heap_size  = Total_RAM / 2 / no_of_servers_instance
For example, to support two servers instance  on a machine with 4  GB of RAM:
max_heap_size = 4 GB / 2 / 2
         =2 GB /  2  =  1 GB
 
The maximum heap size is 1 GB  for each server instance.

Default maximum heap size is 250 MB

                Increasing the minimum heap size & maximum heap size can improve the start-up of application server. The number of garbage collection (GC)  occurrences are reduced and a 10% gain in performance is realized.

How to determine Max Heap Size is too large or too small  for your application.?      If  GC takes a so long time to clean up objects with large heap, you can reduce the maximum heap size. If  GC frequency is too high, the heap may be too small for the application and GC needs to run frequently, so you may increase the maximum heap size.

How to change context root of application (URI) in WebSphere RAD?

In this section, let us see how to change context root of an application in WebSphere.  Suppose you have created a project called "Test".  And the  web project is TestWeb.

Now open the application.xml under META-INF folder inside the Project Test  OR You can directly open the file application.xml inside the  folder c:\workspace\Test\META-INF in windows.
               where c:\workspace is the work space name where your project is created and Test the project name.


Edit the line

<context-root>Test</context-root>

to

<context-root>NewConetxRoot</context-root>

For example, <context-root>MyTest</context-root>


Now Re-Compile the project to publish.


Now everything done, you can access the application

    http://localhost:9080/MyTest



To view the context root in Websphere Application Server through administrative console page,
   Navigate to    Applications > Application Types > WebSphere enterprise applications > application_name (In our example Test)  > Context root for web modules.



Sunday, September 2, 2018

Clustering in WAS -WebSphere Application Server Interview Questions - Part -18.1

Q)    What is work load manager in WebSphere? What is the default work load management policy?



A) ----> Workload management (WLM) is a WebSphere facility that provides load balancing and affinity between application servers in a WebSphere clustered environment. 

----> WLM is an important fact of performance. WebSphere uses workload management to send requests to alternate members of the cluster. 

----> WebSphere can also be configured to route concurrent requests from a user to the application server that serviced the first request. This is called session affinity and can be used to maintain a users session over concurrent HTTP requests

----> WLM is configurable. The administrator should ensure that each machine or server in the configuration processes  share  the overall client load that is being processed by the system as a whole. 

----> Workload should be spread among machines such that the workload corresponds to the machine processing power.





Q)  What is High Availablity in WebSphere?

A) ----> High Availability means nothing but clustering concept .

 ----->Application should be live for the 365 day for those kind of application they kept in cluster. When the request comes from client it should handle. this concept is called as high availablity

                                        (0R) 

-----> Application availability for the users who are using it. 

------> We can provide the high availability by installing the application in different cluster members. 

-----> In case one of the Application Servers fails other Application server which is in the cluster group will server the request so then the customer request can served quickly.



VERTICAL CLUSTER CONFIGURATION :

           
STEP 1:  Goto Cluster.

STEP2 : Click New.

STEP3: Give Cluster Name.

STEP4 : Prefer LOCAL (By default enable)

STEP5 : Click Next Button.

STEP6: Add Cluster Member 1

STEP7 : Weight (2 Members ---> Equivalent weight)

STEP8 : Add Cluster Member2

STEP9 : Generate unique HTTP ports.

STEP10 : Click Finish Button.

STEP11 : Select Scope.

STEP12 : Controlling Cluster.

STEP13 : Start Cluster Member1

STEP14 : Start Cluster Member2

STEP15 : LogOut from AdminConsole.

STEP16 : Again LogIn to AdminConsole.

STEP17 : See in AdminConsole both Clusters are started.

                         (or)

STEP BY STEP FOR CREATING CLUSTERS.

STEP  1   :    ND - None Installation.

STEP  2   :   Create 3 profiles DMGR , APPSRV1 , CUSTOM.

STEP  3   :  Federation (APPSRV1 , CUSTOM) ------> DMGR.

STEP  4   :  IHS   (WEB SERVER + PLUG-IN  )

STEP  5   :  Map Web Server Instance in DMGR.

STEP  6   :  Cluster Creation  (Node A)  ---->  SRV 2
                                                  (Node B) -----> SRV 1

STEP   7   :   Deployed Application under Cluster or Web Server Scope

STEP   8   :  Ensure PLUG-IN Generation and Propogation.

STEP   9   :  Restarts (SERVER 1  ,  SERVER   2  ,   WEB SERVER)

Unix commands - WebSphere Application Server Interview Questions - Part -14.2

Q)  How to check the multiple NIC in Unix or linux? (NIC NETWORK INTERFACE CARD)

A)  ifconfig -a


Q)  
How to identify and kill a process ID?


A) ps -ef



Q)  How will you Check Application Status  ?

A)  ps -ef |grep appservername ( from AdminConsole  ------>  Enterprise Applications ) 



Q) How will you Check the Port Status   ?

A)  using netstat command




Q) What information you get with command ps -ef |grep httpd  ?

A)  We get all Web Servers information with Process ID



Q)  To repeat a Command continuously  ?


A) netstat -a| grep



Q) How to Check Physical Memory RAM in the System  ?

A) bootinf-r Will give you Physical Memory details of Unix Box.



Q) If we want to see the last 7 days data which command we have to use ?

A)Find /home -atime +7
  

  • -atime +7: All files that were last accessed more than 7 days ago
  • -atime 7: All files that were last accessed exactly 7 days ago
  • -atime -7: All files that were last accessed less than7 days ago
Q) Display list of all files in /home directory that were not last modified less than then days ago.

A) find /home -mtime -7

Q) To find file in last 2 months (60 days) you need to use ?

A)  -mtime +60 means you are looking for a file modified 60 days ago.
      -mtime -60 means less than 60 days.
      -mtime 60 If you skip + or - it means exactly 60 days.

Q)  search for just files that have been modified in the last seven days ?

A) find .  -mtime  -7  -type -f

Q)  search for just directories that have been modified in the last seven days ?

A) find .  -mtime  -7  -type -d


Q)  you want to search the "/tmp" directory instead of the current directory for files modified in the last three days ?

A) find  /tmp  -mtime  -3  -type  -d

Q) find a file or directory that has been modified in the last seven days ?

A) find .  -mtime  -7

Unix commands - WebSphere Application Server Interview Questions - Part -14.1

DISK COMMANDS : 



1) du : Gives amount of disk space usage

Syntax : $ du [options] [directory or file]




2) $du –sh file/dir
      ----> Gives the size of the file/dir

3) df -kh : Gives Available space mounted on file system.

4) du -sm : Shows in no of blocks.




LS COMMANDS :

1) ls -al   :  To show all files in Current directory.

2) ls -ltr  :  List the files in directory with the Newest files last.

3) ls - l | grep "^d" : Only users created directories in your system.

4) ls -of -i  : 9080 To check the port

5) less  : To view tar files without untar.




COMPRESS COMMANDS : 

1) gzip  :  Used to compress the file.

2) gunzip : Decompress a file.




PROCESS COMMANDS :



1) ps -ef : All ports will be displayed.

2) ps -ef | grep java : Show all Java processes.

3) ps -ef | grep java | wc -l  : To show how many java processes are running on system.

4) ps -ef | grep java | wc -c  : Display one line Character Count.




SEARCH COMMANDS :



1) Find  : The find command is used to find the files in the hard drive.

Example: $ find *.pl



2) Locate  :  The locate command is much faster than the find command.

-----> Finding a file using locate is faster when compared to the find command


Example : $ locate



Q)   How to check a particular port is working or not in unix?



A)  netstat -a | grep 80




Q) What is the present LINUX VERSION  ?



A) VERSION 5.0


Q)  In ls -lrt, what t stands for and r stands for l stands for?



A)  -l shows you huge amounts of information (permissions, owners, size, and when last modified.)

     -r reverses the order of how the files are displayed.
     -t shows you the files in modification time


Q)  How to check WAS is running or not through PS?

A)  Ps -grep

Next Page : http://webspherelife.blogspot.com/2018/09/unix-commands-websphere-application_2.html

WAS definitions - WebSphere Application Server Interview Questions - Part -8.7

36)  What is Symptom Database  ?

A)   ----->  A Symptom is an error or event message.

      ----->  A Symptom Database is an XML file of symptoms , string match patterns , Associated solutions and directives.

     ------>  Log records  can be analyzed using Symptom Database to interpret known events and error conditions.

    ------>  Symptom Databases can be imported from external XML Symptom  Database , saved and exported into an external file in XML format.

   ------> You can either import Symptom Database from local or remote Host.


37)  What is Clustering  ? Types of Clustering  ?

A)   ----->  It is a set of AppServers having same applications Installed,Grouped locally for WORKLOADMANAGEMENT (WLM)

    ------>  Grouping of AppServers under a single application

    ------>  Every cluster member must have the same configuration and same version.We can say each cluster member is the clone to one another. 



  There are 2 types of CLUSTERING   
     
1)   1) VERTICAL CLUSTERING : Deployed the application on one machine and we can run that application on our own box(or) machine.

----> In this Vertical Clustering Machine FailOver is not possible.

----> If the machine gets failed we cannot run that application (or) SINGLE POINT OF FAILURE.

---> If one Server fails the other Server will takes care

----> If machine fails nothing can be done.

-----> But when the physical machine failover happens we will lose every thing


   2) HORIZONTAL CLUSTERING : Grouping of AppServers in which one AppServer should be on one node and Another AppServer should be on another node.

-----> Means if we take two machines one application should be deployed on different machines Remotely (or) one application should run in INDIA and another application should run in AMERICA.

-----> If Machine1 application will be deployed on Machine2 so we have to know the IP address of Machine1 then only it is possible to deployed that application Successfully.

----> Both Machines should have Internet Connection.

----> Here no SINGLE POINT OF FAILURE. 

----> It Supports MACHINE FAILOVER.


38)  How will you fix Memory Leakage in WAS  ?

A)  ----> Memory Leakage issue is in Native code

     ----> For this issue we can need to get Heap Dumps and analyze the Dumps for any Memory issues.

   -----> If we got any issue we need to ask developers to fix this issue.

   ----->  For Temporary purpose we can increase Heap size.

WAS definitions - WebSphere Application Server Interview Questions - Part -8.6

31)  Administrator benefits using Web Sphere  ?

A)   ------>  Web Sphere almost reduces the work of server Administrator.

      -------> He can manage load on Servers efficiently.

      ------->  Flexibility to divide load and applications among different Servers.

      ------->  Predict the incoming load on Servers.

      -------->  Email alerts , Restart options , Memory leak detection.   


32)  NETWORK DEPLOYMENT feature present in WAS  ?

A)   ------> It provides hot recovery of single tons which makes you forget about GARBAGE COLLECTED single tons.

     ------>  Transaction logs can stored on Shared file system.

     ------>  In run time Clustering operations of deployment managers role is eliminated.

    -------> J2EE FAILOVER support , Cell configuration support is present.


33) What is Caching Proxy of IBM Web Sphere Edge Server  ?

A)   ----->  Caching Proxy can configured in forward direction or a Proxy.

      ------> Page fragments arising from JSP/SERVLETS are cracked by edge and Caching process is slow.

     ------->  Performance and Scalability of J2EE applications can be increased by edge.


34)  How many SSL Certificate Authorities available in todays market  ?

A)  1) ETRUST

      2) VERISIGN

      3) GEOTRUST

      4) RSA


35Dis Advantages of Memory to Memory replication  ?

A)  -----> Consumes large amount of memory in networks with many users.

     ------> Each Server has a copy of all Sessions.

     ------> When we change a Session it will be replicated to all Application Servers.

Next Page : http://webspherelife.blogspot.com/2018/09/was-definitions-websphere-application_37.html
Related Posts Plugin for WordPress, Blogger...

Recover password from .sth file

Create perl file (unstash.pl) and run the script. #!/usr/bin/perl #usage perl unstash.pl use strict; die "Usage: $0 \...