Friday 27 January 2017

Install WebLogic in Linux Environment

We first create a user, for example, oracle. To create a user run the following commands under the root user:

    useradd oracle
    passwd oracle

This creates a /home/oracle directory. To delete the user we can use: userdel -r oracle the option -r removes the /home/oracle directory.

The following software versions will be used:
  • JRockit JVM – jrrt-4.0.1-1.6.0-linux-x64 
  • WebLogic Server – wls1035_generic
First, we choose an installation directory, for example /home/oracle/weblogic. This will be our middleware home in the installation of WebLogic.

To install JRockit we follow these steps:
  • Run the file jrrt-4.0.1-1.6.0-linux-x64.bin. 
  • Click Next on the welcome screen. 
  • Define the install directory /home/oracle/weblogic/jrrt-4.0.1-1.6.0 and click Next. 
  • Optionally select extra components and click Next. 
  • When the installation is finished click Done.

To install WebLogic we follow these steps:
  • Navigate to the JDK’s bin directory (/home/oracle/weblogic/jrrt-4.0.1-1.6.0/bin). 
  • Enter the following command: ./java -d64 -Xms1024m -Xmx1024m -jar wls1031_generic.jar. 
  • Click Next on the welcome screen. 
  • Define the Middleware-Home directory which was used to install the JDK and click Next. Click Yes in the pop-up. 
  • Fill in support credentials if applicable and click Next. 
  • Select Custom as installation type and click Next. 
  • De-select the evaluation database and click Next. 
  • Select the installed JDK (if the JDK is not shown, click Browse and browse to the root of the JDK) and click Next. 
  • Accept the defaults in the directories screen and click Next. 
  • Click Next to start the installation. 
  • De-select Run Quickstart and click Done.

How to install the Admin Server of a SOA domain as a Windows Service?

Steps to install the SOA Domain are:

1) Install Oracle XE under C:\Oracle\oraclexe


2) Alter the processes using sql plus with the following SQL:


alter system set processes = 200 scope=spfile;
commit;


3) Install WLS 10.3.3 under C:\Oracle\Middleware
4) Install SOA 11.1.1.2 under C:\Oracle\Middleware\Oracle_SOA1
5) Install SOA 11.1.1.3 under C:\Oracle\Middleware\Oracle_SOA1 (To avoid potential issues with the patching utility)
6) Create a SOA Domain with successful testing of the Database schema
7) Modify the nodemanager.properties file, located under <Middleware_home>\<WL_Home>\common\nodemanager folder and set the following values to the properties:
CrashRecoveryEnabled=true
StartScriptEnabled=true
8) Install NodeManager as a Windows Service.
        ...
        @echo off
        SETLOCAL
   
        set WL_HOME=D:\Oracle\Middleware11gR1PS3\wlserver_10.3
        rem call "%WL_HOME%\common\bin\commEnv.cmd"
        call "%USERDOMAIN_HOME%\bin\setDomainEnv.cmd"
   
        @rem Check that the WebLogic classes are where we expect them to be
        :checkWLS
        ...

        @echo off
        SETLOCAL
   
        set WL_HOME=D:\Oracle\Middleware11gR1PS3\wlserver_10.3
        rem call "%WL_HOME%\common\bin\commEnv.cmd"
        call "%USERDOMAIN_HOME%\bin\setDomainEnv.cmd"
   
        @rem Check that the WebLogic classes are where we expect them to be
        :checkWLS
        ...
9) At this point we need to run the script file we created to install the admin server as a windows service. 

sqlplus / as sysdba
10) Run RCU and select SOA infrastructure under SOA & BPM infrastructure. 

Resetting Admin UserName And Password

How to Decrypt WebLogic Password ? 

Many times we want to Alter WebLogic Admin Username and passwords on a Routine Basis…

If you want to Reset The WebLogic Username and Password then Please follow the Steps mentioned Below…(EXACTLY):

Step1). open a Command Prompt and then run “setDomainEnv.sh” or “setDomainEnv.cmd”.

Step2). Just for Safety Take a Backup of (C:\bea103\user_projects\domains\7001_Domain\security\*DefaultAuthenticatorInit.ldift*) file …because in the Next Command which we are going to run is going to Create a New File “DefaultAuthenticatorInit.ldift”.

Step3). In the Command Window Move inside your Domain’s Security Directory…And then Run the Following Command:

Example: C:\bea103\user_projects\domains\7001_Domain\security>java weblogic.security.utils.AdminAccount newAdmin newPassword .

Syntax: java weblogic.security.utils.AdminAccount <NewAdminUserName> <NewAdminPassword>

NOTE:- There is a . (DOT) at the end of the Above command which represents the Current Directory. Here you can see that after this command Executes A new “DefaultAuthenticatorInit.ldift” file will be created in the Current Directory.

IMPORTANT STEP   [This Step 3-A) U Need Not to Follow If you Already Forgot your Admin Credentials]

Step3-A).  Login to Admin Console

Security Realms—> myrealm(Your realm Name)—> Migration(Tab)—> Export (Tab)

Here please provide a Directory location for “Export Directory on Server:” TextBox (Example: C:\UserData)

Click on “Save” button…you will find that in the Directory which you have specified you will get :

DefaultAuthenticator.dat
DefaultCredentialMapper.dat
exportIndex.dat
XACMLAuthorizer.dat
XACMLRoleMapper.dat

Step 4). In the Same command prompt Move inside the admin Server folder inside your domain. And then Just remname the “data” folder to something else ….like “data_OLD” this is a way of taking safe backup….

Example: C:\bea103\user_projects\domains\7001_Domain\servers\AdminServer> rename data data_OLD

Step 5). Now Similarly rename the boot.properties as well to an other File….

Example: C:\bea103\user_projects\domains\7001_Domain\servers\AdminServer\security> rename boot.properties boot.properties_OLD

Step 6). Make sure that “boot.properties” file exists….If yes then Now start The Admin Server….

While starting it will ask for the UserName and Password to be entered as ..we havenot created any “boot.properties” file at present. But it is always recommended that u create the “boot.properties” file on your own …to prevent WebLogic Prompting you for Admin Username & Passwords while starting the Server.

————> At the End Login to Admin Console with the New Useraname and Password—–> Check the Users in Security realms …you will not find any user with name “weblogic” There….

This is most important Step:  Because Sometimes we face this kind of issue if you have provided a Wrong format in your “boot.properties” file there should be NO Special Charachers (UTF or Invisible sharacters) Or NO Space in your “boot.properties” file …except below two Lines:

    username=MyAdminUserName
    password=MyAdminPassword

Please edit this File very carefully….better use Noteopad kind of Simple Editors.
Use “ls” (Unix command) or “dir” Windows Command to Make Sure that the File Extension is “boot.properties” only…and not “boot.properties.txt” or something else.

Note: There should be No Heading Or Trailing SPACE character in these two Lines.

Step 7).  To import other User Data back Please do the following:

Login to Admin Console
Security Realms—> myrealm(Your realm Name)—> Migration(Tab)—> Import (Tab)

Now provide the folder Name where u have all the above files:
DefaultAuthenticator.dat
DefaultCredentialMapper.dat
exportIndex.dat
XACMLAuthorizer.dat

XACMLRoleMapper.dat

Rotation of .out log files created by node manager

Unfortunately there is no way provided with node manager or weblogic to rotate your .out log files created by node manager , you have to manually cleanup them or you can use  any of the below method to auto cleanup the same.

1st Method
----------
-----

You can redirect .out logs to the .log file and managed .log via admin console.
[ console > your_server > under logging tab ]

Fot this - 

Go to to YOUR_DOMAIN/bin/nodemanager
Take a backup of your existing wlscontrol.sh
Edit it and change OutFile=$ServerDir/logs/$ServerName.out to OutFile=$ServerDir/logs/$ServerName.log




2nd Method
-----------
------

on Linux, You can change OS parameters in /etc/logrotate.conf file 

Append below lines at the end

<out_log_file_dir_path>/*.out
{
copytruncate
rotate 4
size=500Mb
}

OR

Use command "logrotate" using cron to achieve, You can use it with copytruncate to rotate logs.


3rd Method
-----------
-----

Add option -Dweblogic.log.RedirectStdoutToServerLogEnabled=true to redirect .out logs to .log log file and manage it via admin console

[ console > your_server > under logging tab ]

Create Machine configure NodeManager using WLST for 12.2.1

Create Machine configure NodeManager using WLST

This blog post is renovated with latest WebLogic 12.2.1 version execution output here. We have more generic reusable functions, three different functions each one has independent task. Where the pre condition for this is you must have a domain configured and admin server is running.

  1. create a machine and setup the Nodemanager 
  2. delete machine from the domain
  3. show all machines in the domain


?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#==========================================================================
# FileName      : createMachine.py
# Updated       : 11/22/2015
# Description:
# This simple script will create multiple machines
# and also set the NodeManager properties
# use demo.properties file loadProperties command line argument expected
#
# You can add this function block to full domain
#==========================================================================
 
def createMachine(machineName, machineIP,nmPort=5556):
        """
        This function takes three arguments machineName, machineIP, nmPort
        The default nmPort is 5556 and nmType as Plain
        """
        cd('/')
        cmo.createUnixMachine(machineName)
 
        cd('/Machines/'+machineName+'/NodeManager/'+machineName)
        cmo.setNMType('Plain')
        cmo.setListenAddress(machineIP)
        cmo.setListenPort(nmPort)
        cmo.setDebugEnabled(false)
 
def deleteMachine(machineName):
        """
        This function takes machineName as argument
        It will delete the Machine MBean from the Domain
        """
        cd('/')
        editService.getConfigurationManager().removeReferencesToBean(getMBean('/Machines/'+machineName))
        cmo.destroyMachine(getMBean('/Machines/'+machineName))
 
def printMachineList():
        """
        This function will display the machines configured on a domain
        No arguments required
        """
        cd('/')
        redirect('/dev/null', toStdOut='false')
        machineslist=ls('Machines',returnMap='true')
        for m in machineslist: print m
        stopRedirect()
 
def main():
        """
        Here we can expect ConnectionException, WLSTException
        and also BeanAlreadyExist for createMachine function
        """
        connect(ADMINUSER,ADMINPASSWD, ADMINURL)
 
        print "Before machines creation..."
        printMachineList()
 
        edit()
        startEdit()
 
        for i in range(1,5):
                try:
                        createMachine('machine'+str(i), '192.168.33.'+str(100+i),5566)
                except:
                        print 'Machine creation failed...'+'machine'+str(i)
        activate()
 
        print "After creation..."
        printMachineList()
 
        HitKey=raw_input('Press any key to continue...')
 
        startEdit()
        for i in range(1,5):
                try:
                        deleteMachine('machine'+str(i))
                except:
                        print 'Unable to remove machine...'
        activate()
 
        print "After removing machines..."
        printMachineList()
main()
Excecution of the Machine configuration is as follows.... 


java weblogic.WLST  -loadProperties demo.properties createMachine.py

create, delete and show machines in WebLogic 12.2.1 domain

Double confirmation with Admin console

Machine in WebLogic Domain configured with WLST


Start n Stop the Server using NodeManager by WLST

Manage the Server Life Cycle continues...
[2] Configure a NodeManager to start WebLogic Server instances (using console and command-line) 

Start n Stop Server using NodeManager by WLST:

In the sun Solaris environment we need to change few nodemanager.properties to run the NodeManager. There are two kinds of Node Managers available 
Java based Node manager
Script based Node manager

while connecting to nodemanager we have received an error as below:

Error encounter when the java native 
bash-3.00$ tail -100f nodemanager.log 


weblogic.nodemanager.common.ConfigException: Native version is enabled but node manager native library could not be loaded
at weblogic.nodemanager.server.NMServerConfig.initProcessControl(NMServerConfig.java:239)
at weblogic.nodemanager.server.NMServerConfig.(NMServerConfig.java:179)
at weblogic.nodemanager.server.NMServer.init(NMServer.java:177)
at weblogic.nodemanager.server.NMServer.(NMServer.java:142)
at weblogic.nodemanager.server.NMServer.main(NMServer.java:327)
at weblogic.NodeManager.main(NodeManager.java:31)
Caused by: java.lang.UnsatisfiedLinkError: no nodemanager in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at weblogic.nodemanager.util.UnixProcessControl.(UnixProcessControl.java:16)
at weblogic.nodemanager.util.Platform.getProcessControl(Platform.java:108)
at weblogic.nodemanager.server.NMServerConfig.initProcessControl(NMServerConfig.java:237)
... 5 more

java weblogic.WLST startAdmin.py wcludomNM

connect('weblogic', 'weblogic', 't3://wlhost:7913')
nmEnroll('/home/wluser/domains/WLclsnm')
CLASSPATH to set for NodeManager:
export NM_HOME = $WL_HOME/common/nodemanager

CLASSPATH=/export/home/wladmin/wl813/bea/jdk142_04/jre/lib/rt.jar:/export/home/wladmin/wl813/bea/jdk142_04/lib/rt.jar:/export/home/wladmin/wl813/bea/patches/CR204958_810sp3_v1.jar:/export/home/wladmin/wl813/bea/weblogic81/server/lib/weblogic.jar

startNodeManager(verbose='true',NodeManagerHome='/home/wluser/bea/weblogic92/common/nodemanager')

To Check the log of nodemanager.log
tail -100f /home/wluser/bea/weblogic92/common/nodemanager/nodemanager.log

/home/wluser/bea/weblogic92/common/nodemanager/nodemanager.domains>

nmConnect('weblogic', 'weblogic', 'wlshostname','5556', 'WLclsnm', '/home/wluser/domains/WLclsnm')

prps = makePropertiesObject('weblogic.ListenPort=9013')
wls:/WLclsnm/serverConfig>
wls:/WLclsnm/serverConfig> nmStart('app01',props=prps)
Starting server app02 ...
Error Starting server app02: weblogic.nodemanager.NMException: 
Exception while starting server 'app02': java.io.IOException: Server failed to start up. See server output log for more details.

prps = makePropertiesObject('weblogic.ListenPort=9013')

start('wlctr', 'Cluster')

nmStart('app02',props=prps) 
Starting server AdminServer...
Server AdminServer started successfully

nmConnect('weblogic', 'weblogic', 'remotehostnameofmanagedserver' '5556','WLclsnm', '/home/wluser/domains/','plain')

Still workin progress to start the remotemanaged server by using wlst
(I am getting some errors when I tried ...will update this site Once it will done successfully if anybody is done plz post it as comment.)