Saturday, December 22, 2018

Working with WLST with Node Manager

Commands:

nmConnect : Connect to Node Manager
nmServerStatus: Print Server status of connected domain.
nmStart: Start Weblogic Server( Admin or Managed Servers)
nmKill: Stop Weblogic Server


Common Errors & Exampls:
=>Error: Could not find or load main class weblogic.WLST
Reason : Error means that the correct CLASSPATH has not been set
The setWLSEnv.sh script needs to be sourced in order to execute the script in the context of the running shell, and have the actual environment of the shell be set. It has to be executed as either “. ./setWLSEnv.sh” (notice the extra dot) or “source ./setWLSEnv.sh” and then the CLASSPATH can be confirmed in the current shell with the “env” command.

Simply executing the script “./setWLSEnv.sh” will only display the output on the screen.

The alternative is to run directly the specific wlst.sh of the Oracle product that is installed. This will automatically set the correct environment for that product.

The script is located under $ORACLE_HOME/common/bin/wlst.sh

=>Connect NodeManager from WLST Tools
nmConnect([username, password], [host], [port], [domainName], [domainDir], [nmType])
nmConnect([userConfigFile, userKeyFile], [host], [port], [domainName], [domainDir], [nmType])

Example : nmConnect
wls:/offline> nmConnect('nodemanager','nodemanager123','localhost','5556','base_domain','/home/skubuntu/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain','plain')
Connecting to Node Manager ...
Successfully Connected to Node Manager.
wls:/nm/base_domain>

Example : nmServerStatus
wls:/nm/base_domain> nmServerStatus('node1')
RUNNING
wls:/nm/base_domain>

Example : nmStart
wls:/nm/base_domain> nmStart('node1')
Starting server node1 ...
Successfully started server node1 ...

wls:/nm/base_domain>


Example : nmKill
wls:/nm/base_domain> nmKill('node1')
Killing server node1 ...
Successfully killed server node1
wls:/nm/base_domain> 

Import Links:
http://www.dba-oracle.com/t_weblogic_wlst_server_start.htm
Books : Advanced WebLogic Server Automation

Friday, December 21, 2018

1. Working with Weblogic

WebLogic Installation & Configuration Step by Step

Steps
1. Download JDK.
2. Install JDK
3. Download WebLogic
4. Install WebLogic.
5. Create domain.
6. Configure nodemanager
7. Configure Machine.
8. create managed server
9. create cluster.
10. Deploy application

Administration Commands with Examples:

1. Start managed server from backend

=>Using unsecure connection
./startManagedWebLogic.sh node1 http://skubuntu:7001 
=>Using t3 protocol
./startManagedWebLogic.sh node1 t3://skubuntu:7001 
=>Using secure connection
./startManagedWebLogic.sh node1 https://skubuntu:7002 
=>Run in background
./startManagedWebLogic.sh node1 t3://skubuntu:7001 &  

2. Stop managed server from backend

./stopManagedWebLogic.sh node1 t3://skubuntu:7001




To install Java JDK 8 
1. Add A Third Party PPA to Ubuntu
ubuntu@skubuntu:/Store/Software/Linux$  sudo add-apt-repository ppa:webupd8team/java
[sudo] password for ubuntu:



Press Enter 
Output:

 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK8). There are no actual Java files in this PPA.

- http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
- Oracle Java 8: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
 More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [221 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [85.0 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [108 kB]
Get:9 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic/main amd64 Packages [1556 B]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [61.4 kB]
Get:11 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic/main Translation-en [928 B]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1440 B]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [460 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [172 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [705 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [171 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [6372 B]
Fetched 2256 kB in 8s (271 kB/s)
Reading package lists... Done
ubuntu@skubuntu:/Store/Software/Linux$

ubuntu@skubuntu:/Store/Software/Linux$ sudo apt update
Press Enter
Left Arrow Key then Press Enter #####Important########
To set Oracle JDK8 as default, install the "oracle-java8-set-default" package.
E.g.: sudo apt install oracle-java8-set-default
On Ubuntu systems, oracle-java8-set-default is most probably installed
automatically with this package.
###################### /usr/bin/java




































java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)


x
x
Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html
Update: Oracle Java 9 has reached end of life: http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html
The PPA supports Ubuntu 18.10, 18.04, 16.04, 14.04 and 12.04.
More info (and Ubuntu installation instructions):
Debian installation instructions:
For Oracle Java 11, see a different PPA -> https://www.linuxuprising.com/2018/10/how-to-install-oracle-java-11-in-ubuntu.html
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease [15.4 kB]






2. Update and install Oracle Java 8 on Your machine




ubuntu@skubuntu:/Store/Software/Linux$ sudo apt install oracle-java8-installer



ubuntu@skubuntu:/Store/Software/Linux$ which java
ubuntu@skubuntu:/Store/Software/Linux$ java -version
ubuntu@skubuntu:/Store/Software/Linux$
To install WebLogic on Ubuntu 

1. Unzip the zipped installation file.

ubuntu@skubuntu:/Store/Software/Linux$ unzip fmw_12.2.1.3.0_wls_Disk1_1of1.zip
Archive:  fmw_12.2.1.3.0_wls_Disk1_1of1.zip
  inflating: fmw_12.2.1.3.0_wls.jar
  inflating: fmw_12213_readme.htm
ubuntu@SKWindowsPro:/mnt/c/ShareDrive/Software/Linux$

ubuntu@skubuntu:/Store/Software/Linux$ java -jar fmw_12.2.1.3.0_wls.jar
Launcher log file is /tmp/OraInstall2018-12-17_02-24-47PM/launcher2018-12-17_02-24-47PM.log.
Extracting the installer . . . . . . . . . . . . . . .



2. Install WebLogic.

ubuntu@SKWindowsPro:/mnt/c/ShareDrive/Software/Linux$ java -jar fmw_12.2.1.3.0_wls.jar
Launcher log file is /tmp/OraInstall2018-12-17_02-24-47PM/launcher2018-12-17_02-24-47PM.log.
Extracting the installer . . . . . . . . . . . . . . . . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2295.000 MHz    Passed
Checking monitor: must be configured to display at least 256 colors.  DISPLAY environment variable not set.    Failed <<<<
Checking swap space: must be greater than 512 MBChecking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 153335 MB    Passed

Some system prerequisite checks failed.
You must fulfill these requirements before continuing.

Continue? (yes [y] / no [n]) [n]
y
You have confirmed that the product can be installed on this platform.
Continuing with the installation.


Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2018-12-17_02-24-47PM
DISPLAY is not set.  Please set the DISPLAY environment variable and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh:                      %% setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash:         $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
%% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
%% <full path to xclock; see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
        at java.awt.Window.<init>(Window.java:536)
        at java.awt.Frame.<init>(Frame.java:420)
        at java.awt.Frame.<init>(Frame.java:385)
        at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1763)
        at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1838)
        at javax.swing.JDialog.<init>(JDialog.java:272)
        at javax.swing.JDialog.<init>(JDialog.java:206)
        at javax.swing.JDialog.<init>(JDialog.java:154)
        at oracle.as.install.engine.modules.presentation.ui.common.dialogs.SpecifyInventoryDirectoryDialog.<init>(SpecifyInventoryDirectoryDialog.java:248)
        at oracle.as.install.engine.modules.presentation.ui.common.dialogs.SpecifyInventoryDirectoryDialog.showDialog(SpecifyInventoryDirectoryDialog.java:781)
        at oracle.sysman.oio.oioc.OiocOneClickInstaller.main(OiocOneClickInstaller.java:643)

The log(s) can be found here: /tmp/OraInstall2018-12-17_02-24-47PM.
ubuntu@SKWindowsPro:/mnt/c/ShareDrive/Software/Linux$

=>Solve display problem 
ubuntu@SKWindowsPro:/mnt/c/ShareDrive/Software/Linux$ DISPLAY=192.168.1.128:0.0; export DISPLAY
ubuntu@SKWindowsPro:/mnt/c/ShareDrive/Software/Linux$ echo $DISPLAY

192.168.1.128:0.0

-ignoreSysPrereqs


=>Solve UnsatisfiedLinkError
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libawt_xawt.so: libXrender.so.1: cannot open shared object file: No such file or directory

=>
sudo apt install x11-xserver-utils
sudo vi /etc/ssh/ssh_config

Sunday, December 16, 2018

STARTING WEBLOGIC SERVER IN DEVELOPMENT OR PRODUCTION MODE


WebLogic Server domains start up in development mode by
default. To change startup mode for a domain, follow
the below instructions.

Start the server in development mode :

From the command line with the parameter: 
   -Dweblogic.ProductionModeEnabled=false setting.

Example : 
domains/base_domain$ ./startWebLogic.sh -Dweblogic.ProductionModeEnabled=false

Start the server in production mode 

From the command line, use the parameter: 
-Dweblogic.ProductionModeEnabled=true setting.
Example : 
domains/base_domain$ ./startWebLogic.sh -Dweblogic.ProductionModeEnabled=true