Tuesday, December 10, 2024

wlst script to restart weblogic managed server

stopserver1.py

import sys

connect('user','pw','t3://servername:7001')
domainRuntime()
shutdown('server1','Server','true',1000,'true');
shutdown('server2','Server','true',1000,'true');
exit()

stopserver1.sh

/****/oracle_common/common/bin/wlst.sh /*****/user_projects/domains/ap/restart/stopserver1.py $1 


startserver1.py

import sys

connect('user','pw','t3://servername:7001')
domainRuntime()
start('server1','Server','true',1000,'true');
start('server2','Server','true',1000,'true');
exit()

Wednesday, September 25, 2024

shell script to collect todays cache details of weblogic jvm and send email

 

The following shell script collects today's cache details of weblogic jvm and sends out an email.
The script can ssh to many linux servers and only collect cache details were cache has been created on the present day.

The servers should already have keyless SSH enabled between them

Below is the script

 #!/bin/sh
echo -e "\e[0;36m++++++ \e[0m"
echo -e "\e[0;36m Author : robin.richard@****.com \e[0m"
sleep 5
echo -e "\e[0;36m++++++ \e[0m"
printf "\n ======================= \n Begining cache collection in  PROD  \n ======================= \n"
sleep 4
rm -r report.txt
printf "\n ======================= \n purging old data \n ======================= \n"
echo -e "\e[0;36m++++++ \e[0m"
sleep 5
#rm -r report.txt
for i in oracle@server oracle@server oracle@server oracle@server oracle@server; do ssh $i 'echo  "Server: $(hostname) - Date: $(date)" && find /<path>/servers/*/tmp/_WL_user/ -daystart -ctime 0 -print' >> report.txt; done
sleep 4
printf "\n ======================= \n Completed Cache collection \n ======================= \n"
echo “ prod  cache details” | mail -s “Prod_cache_details” robin.richard@****.com,rramaneedi@****.com,hsinghchouhan@****.com < report.txt
printf "\n ======================= \n Sending Email \n ======================= \n"
echo -e "\e[36;41m++++++ \e[0m"
printf "\n ======================= \n Exiting the system \n ======================= \n"
echo -e "\e[36;41m++++++ \e[0m"

You can also put the script in bash profile as follows
vi ~oracle/.bashrc
alias cachecollector='/home/oracle/cache_collector/robin.sh &'

 

also you can try

for i in oracle@server oracle@server oracle@server oracle@server oracle@server; do ssh $i 'echo  "Server: $(hostname) - Date: $(date)" && echo -e "\e[0;36m++++++ \e[0m" && find /<path>/servers/*/tmp/_WL_user/ -daystart -ctime 0 -print | xargs ls -ltr && echo -e "\e[0;36m++++++ \e[0m"' >> report.txt; done 


or 


for i in oracle@server oracle@server oracle@server oracle@server oracle@server ; do ssh $i 'echo  "Server: $(hostname) - Date: $(date)" && find /<path>/servers/*/tmp/_WL_user/ -daystart -ctime 0 -print' >> report.txt; done


or 


for i in oracle@server oracle@server oracle@server oracle@server oracle@server ; do ssh $i 'echo "********" && echo  "Server: $(hostname) - Date: $(date)" && find /<path>servers/*/tmp/_WL_user/ -daystart -ctime 0 -print && echo "********"' >> report.txt; done


Print index.html from todays date

find /<path>/*/index.html -daystart -ctime 0 -print

Print folders only of todays creation date

find /<path>/*/<path>s/*/tmp/_WL_user/ -mindepth 1 -maxdepth 1 -ctime 0 -print

Thursday, August 29, 2024

java.lang.ClassNotFoundException: javafx.application.Application

 PROBLEM : While installing vertex receiving javafx issues

ERROR: 


Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at com.vertexinc.tps.install.app.InstallApp.main(InstallApp.java:22)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)


REASON: javafx has been removed from java11, however it is still available in java8

so use JDK 8 version

Thursday, July 18, 2024

solr failed to start

 

Error : OpenJDK 64-Bit Server VM warning: Failed to reserve shared memory. (error = 1)

Context: this is a lucene solr 9.0.0 + zk 3.8.0. on a linux server

Solution:  

increment the heap memory at SOLR_HEAP="24g" to accommodate increased collection load.

The file /*/solr/solr-9.0.0/bin/solr.in.sh


 

 

Tuesday, April 30, 2024

Extract Private Key from oracle wallet

 To Extract Private Key from a wallet we would need orapki keytool and openssl.

<<<<<<<<<< Display the contents of the wallet using orapki >>>>>>>>>

/<fmw_home>/oracle_common/bin/orapki wallet display -wallet /<domain_home>config/fmwconfig/components/OHS/instances/ohs1/keystores/wallet/cwallet.sso


<<<<<<<<<<<< copy the wallet to new location say /tmp/robin/wallet >>>>>>>>>>>

convert from pkcs12 to jks and provide password

/<fmw_home>/oracle_common/bin/orapki wallet pkcs12_to_jks -wallet /tmp/robin/wallet -jksKeyStoreLoc /tmp/robin/ewallet.jks 


welcome1

 

<<<<<<<<<<<< <<<<< import keystore >>>>>>>>>>>>>>>>>>>>>>>>

keytool -importkeystore -srckeystore /tmp/robin/ewallet.jks -srcstoretype JKS -deststoretype PKCS12 -destkeystore /tmp/robin/result/ewallet.p12


<<<<<<<<<<<<<<<<<< private key will be in r.txt >>>>>>>>>>>>>>>>>>>>>>>>>>>>

openssl pkcs12 -in /tmp/robin/result/ewallet.p12 -passin pass:welcome1 -out /tmp/robin/result/r.txt -nodes


Friday, April 19, 2024

OHS not starting due to cert issue

 ERROR MSG:

<date> <Info> <Security> <BEA-090909> <Using the configured custom SSL Hostname Verifier implementation: weblogic.security.utils.SSLWLSHostnameVerifier$NullHostnameVerifier.>
This Exception occurred at <date>.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed
Error: Error occurred while performing nmConnect : Cannot connect to Node Manager. : sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed
Use dumpStack() to view the full stacktrace :

FACTS:

1. Nodemanager is running in SSL mode

2.OHS is configured to run on SSL mode

3. OHS uses wallet with default self signed cert

Solution:

<<<<<<<<TO DISPLAY the contents of the WALLET>

oracle_home/oracle_common/bin/orapki wallet display -wallet domain_home/ohs_domain/config/fmwconfig/components/OHS/instances/ohs1/keystores/default/cwallet.sso

<<<<<<<<< export cert to a file >>>>>>>>>>
oracle_home/oracle_common/bin/orapki wallet export -wallet . -dn "CN=localhost,OU=FOR TESTING ONLY,O=FOR TESTING ONLY" -cert domain_home/ohs_domain/config/fmwconfig/components/OHS/instances/ohs1/keystores/cert.txt

<<<<< read the cert in a file to check expiry of cert >>>>>>>>>

cd domain_home/ohs_domain/config/fmwconfig/components/OHS/instances/ohs1/keystore
/oracle_home/oracle_common/bin/orapki cert display -cert cert.txt -complete

<<<<<<<< take a backup of .sso and create a new wallet >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
oracle_home/oracle_common/bin/orapki wallet create -wallet domain_home/ohs_domain/config/fmwconfig/components/OHS/instances/ohs1/keystores/default/wallet -auto_login_only

<<<<<<<<<<<<<<<<<<<<< add new cert to the wallet (self signed cert) >>>>>>>>>>>>>>
oracle_home/oracle_common/bin/orapki wallet add -wallet domain_home/ohs_domain/config/fmwconfig/components/OHS/instances/ohs1/keystores/default -dn "CN=localhost,OU=FOR TESTING ONLY,O=FOR TESTING ONLY" -keysize 2048 -self_signed -validity 3650 -auto_login_only


start the ohs