Tuesday, October 1, 2013

Configure a WebLogic Server Background Service

Configure a WebLogic Server Background Service

server running in the background which is very much required in Production and Test Environments where your operating platform is Windows NT based. Whenever the Windows server is rebooted the WebLogic Admin server or Managed servers running on it are going to started automatically, when they are configured with windows ‘services’.

  1. Use WebLogic existing Domain or Create a Domain for testing 
  2. Create a installation Script per WebLogic server such as AdminServer or Managed Server
  3. Create a .cmd let us workout per AdminServer  with the following  Open notepad or any editor to write the following Windows batch Script

    echo off
    SETLOCAL
    set DOMAIN_NAME=demoDomain                          
    set USERDOMAIN_HOME=F:\irfan\demoDomain  
    set SERVER_NAME=AdminServer         
    call "F:\Oracle\wlserver\server\bin\installSvc.cmd"    
    ENDLOCAL
    

    Write the above code and SAVE it with ‘AdminServerSrv.cmd’ in your domain\bin
  4. open a new CMD prompt with Admin permissions.
  5. Window button + R will give you program that to run “Services.msc”

Upto the WebLogic 10.3.6 it was beasvc binary now it is changed in the WebLogic 12c it is wlsvc file. This will be invoked by installSvc.cmd file. Once the WebLogic server is started in the Operating system services then it will be give access through the Admin Console that you usually use http://adminhost:adminport/console.

Uninstalling the WebLogic server from windows Service

Step 1: Open one more edit window or notepad write the following script commands using “unintallSvc.cmd”
echo off
SETLOCAL
set DOMAIN_NAME=demoDomain                                
set USERDOMAIN_HOME=F:\irfan\demoDomain       
set SERVER_NAME=AdminServer       
call "F:\Oracle\wlserver\server\bin\uninstallSvc.cmd"    
ENDLOCAL

Tuesday, August 13, 2013

Why long way for thread dump on UNIX/Linux machines? Easy Steps!

jps - Java process list : Java Utilitycommand 

I was looking for diagnostic ways with freely available tools from JDK then I found the great valuable command tool 'jps'. The jps command can be used with three options(l, v, m). it can work for any Java - JEE Servers such as WebLogic, WebSphere, JBoss, Tomcat. In other words, any app server that uses the latest JDK 5+ version (version 6, 7, 8 also supports). Let me walk-through those interesting options in Win and *nix platforms. Before you execute this command tool, make sure that JAVA_HOME\bin is in the PATH setting.
Java Command tool : jps options

jps Option : jps -l

this -l option will give the full Java package name that invoked the Java process.
C:\Users\pavanbsd>jps -l
9116 sun.tools.jps.Jps
8812 weblogic.Server
Filtering the weblogic instance with find command on jps will give you the desired outcome.
C:\Users\pavanbsd>jps -l |find "weblogic"
8812 weblogic.Server

jps -v

this -v option is most important for tracking WebLogic, this option gives you the JVM aguments used to invoke the JAVA process (weblogic.Server). Usually for our WebLogic what we set in the setDomainEnv.sh will appear with this option.
C:\Users\pavanbsd>jps -v |find "weblogic"
8812 Server -Xms256m -Xmx512m -XX:MaxPermSize=128m -Dweblogic.Name=adm_clstr_dom -Djava.security.policy=C:\Oracle\MIDDLE
~1\WLSERV~1.3\server\lib\weblogic.policy -Dweblogic.ProductionModeEnabled=true -da -Dplatform.home=C:\Oracle\MIDDLE~1\WL
SERV~1.3 -Dwls.home=C:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dweblogic.home=C:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dweblogic
.management.discover=true -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext
.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\sysext_manifest_classpath

jps -m

this -m option will gives you the Java main() programs command line arguments that used by Java process.
 
C:\Users\pavanbsd>jps -m
8812 Server
8984 Jps -m

The problem of finding Java PIDs

Of course, you can kill the instance in the emergency in the same way this is quicker than regular ps command. Usually, WLA uses the following command for finding the WebLogic managed server process:
ps -fu username

Scanning that process list with your eyes for WebLogic start process, then its child process finally java process in that process list. the whole process looks hectic when there are many WebLogic instances running on the same machine. Sometimes killing wrong process makes nonsense/messy. To avoid such collisions in the decision of killing process best way is using 'jps'.

Try it and know about it then you can enjoy working with it...

Another problem area that will do pain for Middleware admins is that Find is the NodeManager is running or not on a machine (Win/*nix)? the best option I have simply types 'jps' it will give the desired result. Here I found the simple way for taking thread dump with JDK tools which work on the UNIX machine and also in Windows. Assuming that you WLA(WebLogic Admin) are aware of which WebLogic instance needs to take Thread-dump for analysis of an issue. The best option which I use that makes it very easy to do so is the java process in a UNIX box is :
$ jps -lv |grep WL_instancename

This will give you the process id and long view of JAVA_OPTIONS assigned to that instance. Pick that first number (Java PID) and use your regular kill -3 on it :)

The jps command as Troubleshooting helper

The jps command can be used to pipe out the PID for thread-dumps and memory/heap-dumps or Generation wise footprint with the following JDK commands utilities:

  • jstat 
  • jstack
  • jhat 
  • jdb
  • jmap
  • jinfo
  • jvisualvm
  • jconsole

Count WebLogic Servers using jps


Basically while working on Produciton environments, there would be WebLogic server bounce required while doing Application release or some patching happen on some of the middleware architecture components. Sometimes you may need to know how many WebLogic instances are running in that Unix machine or how many left for bounce. Simply you can use our free 'jps' command as shown below
 $jps |wc -l


If you wish to see only java process you can use simply jps command.
$jps


We can use for the WebLogic 9.x 10, 11g versions managed instances for thread dumps or terminating the process.

The same trick will work for all Oracle Fusion Middleware Infrastructure using services such as Oracle Analytics Server (OAS) domain, Oracle Data Integrator (ODI) domain, Oracle Business Intelligence Enterprise Edition (OBIEE), Oracle APEX domain, Oracle SOA Suite, Oracle Service Bus (OSB) domain, OUD, OIM and may more.

Note:
1. This command is available in JDK version 1.5 onwards only.
2. Careful while using long view it shows full details.

Saturday, July 13, 2013

starting Managed server in invisible Window

Problem: Closing startWebLogic.cmd execution window - SHUTDOWN server

We were working on Oracle Fusion Middleware environment, where the WLS_FORMS managed server was down. We need to bring it up by starting the server immediately, because it is live we have tried to start with nodemanager. But, it is failed! due to the stdout log rotation failure unable to start the managed server. The servers running on the same Windows machine are well and RUNNING state.

Production environments we cannot keep a server DOWN for longer time. So first we tried with immediate temporary solution is to start the managed server from the domain home we need to keep a CMD window open. If someone logged in and closed the window the server will be down again! In UNIX we have nohup and &(ampersand) to run in the background. Now we need similar solution in Windows platform. After working in Unix platform for many years, felt Windows is hard to us!!! There is always a way for this problem. Solution we identified as below:

Temprory Fix: Start Managed server in background on Windows platform


Let me give you complete walk through for the Windows Shell script as workaround. Usually, we run the below command line for starting the Form server manually.
C:\wls_domains\clstr_dom\bin\startManagedWebLogic.cmd WLS_FORMS

This server status cannot be updated to Nodemanager if it is started manually like above. Same line we tried to set in the below Windows shell but it couldn't work, so alternative idea is 'Create a new CMD file for starting managed server... like for us it is WLS_FORMS File named as startforms.cmd.

Now create the following .VBS file that will help you to run the managed server in background.

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:\wls_domains\classicDomain\bin\startForms.cmd" & Chr(34), 0
Set WshShell = Nothing

Copy the above lines to Notepad and save the file with the .VBS extension. Edit the .BAT file name and path accordingly, and save the file. Double-click the .VBS file to run it.

In the background we were working on alternative, complete fix. The analysis started with why nodemanager could not start the managed server? What NodeManager saying about this issue. The nodemanager.log file in the nodemanager in the WebLogic installation. The standard out file for Forms, WLS_FORMS.out file not able to rename to new WLS_FORMS.out001xx. I have tried same thing at the command line. It is telling that unable to rename the file due to some other process is using the file. Now there is a need to find that what other file uses this standard out file.

Solution: Stdout log file (SERVER_NAME.out) file Rotation

In the Oracle Fusion Middleware environments, if the Stdout file is being accessed by dejvm. Oracle Forms, Reports running environment uses Developer JVM (dejvm) process. In the Unix environment you can easy to identify with 'ps -ef| grep dejvm'. To resolve the above issue, go to the Windows TaskManager find the dejvm process and kill that. Now no process is using the stdout file, now you start the managed server using nodemanager or Weblogic Console.

Little idea about dejvm - The process named dejvm is a process that Oracle Forms uses as the JVM controller. The jvmcontroller.cfg file defines the defult dejvms. Its purpose in life is to be the process which a pool of JVMs are attached so that not all Forms process that need use WLS_FORMS Server JVM. This lowers system resource usage and in effect pools of JVMs.

Thankyou for being with me in this blog post. write your comment or suggest your experiences that adds more.

Saturday, May 18, 2013

Mailing alerts for Administrator

As a Middleware Admin, we might need to check the mail service is working or not on the Linux machine or Soloris machine on which our Weblogic running. To monitor and send the traps for issues we must have mail service enabled. In Linux how to check mail service up? We have tried to test the sendmail command from the Linux machine. with the following command:
echo "This is the body."| mailx -s "mailx Test1" bhavanishekhar@gmail.com
echo "test" | mailx -s "test_sub" bhavanishekhar@gmail.com
When I tested with the above test message got the error saying as follows: postdrop: warning: unable to look up public/pickup: No such file or directory. There is no mail service is running you validate the same with the following: We have several options checking the processes list for the pattern 'mail'.
$  ps aux | grep mail |grep -v grep
$
or use other option is usually the mail service on Unix machine runs on port 25, so grep it from the network status.
$  netstat -nl|grep 25
Already working but not working then how to debug that wheather it is working or not? My next choice is checking the service.

$ svcs | grep -i sendmail
$ ps -ef |grep -i sendmail

Thanks for these valuable inputs from my mate Mangaleshwaran.

Keep osting us your experience on mailx or sendmail.

cheers!

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6