Search This Blog

Showing posts with label can't write cache file for. Show all posts
Showing posts with label can't write cache file for. Show all posts

Wednesday, February 22, 2017

Restricted JRF WebLogic infrastructure domain configuration using WLST

While working on Fusion Middleware products we need to prepare the WebLogic restricted JRF domain, most of the time configuration Wizard leads to confusion and stuck with what to do for RCU configurations. Even when you need to create a domain for Collocated OHS Environment.

Pr-requisites
  1. Oracle JDK Installed
  2. Oracle Fusion Middleware Infrastructure 12.2.1 installed
  3. Environment setup with bash profile
Templates used for configuring the Restricted JRF domain

  1. JRF Restricted template - oracle.jrf_restricted_template.jar
  2. Enterprise Manager - oracle.em_wls_restricted_template.jar
  3. Coherence - wls_coherence_template.jar [default selected with above anyone of the template]


 Lets first create the properties file:

TEMPLATE=/u01/app/oracle/fmw1221/wlserver/common/templates/wls/wls.jar 
MW_HOME=/u01/app/oracle/fmw1221
ADMIN_LISTEN_ADDRESS=192.168.33.100
ADMIN_PORT=8001
ADMIN_USER=weblogic
ADMIN_PWD=Welcome1
DOMAIN_NAME=RestrictedJRF_Domain
DOMAIN_DIR=/u01/app/oracle/domains

Note: You could modifiy the MW_HOME  path

The WLST Script is  as follows:

def create_prod_domain():
 print "Reading base domain tempalte"
 readTemplate(TEMPLATE)
 cd('/')

 print "AdminServer settings"
 cmo.setName(DOMAIN_NAME)
 cd('Servers/AdminServer')
 cmo.setListenAddress(ADMIN_LISTEN_ADDRESS)
 cmo.setListenPort(int(ADMIN_PORT))
 cd( '/' )
 cd( 'Security/'+DOMAIN_NAME+'/User/' +ADMIN_USER)
 cmo.setPassword(ADMIN_PWD)
 cd('/')

 print "Production domain setup.."
 setOption("ServerStartMode", "prod")
 setOption("OverwriteDomain", "true")
 writeDomain( DOMAIN_DIR+'/'+DOMAIN_NAME )
 print "=============================================="
 print "Production domain created successfully..."
 print "=============================================="

 closeTemplate()


def apply_jrf2domain():
 # Apply the JRF Template.
 print "reading domain:"+DOMAIN_NAME
 readDomain(DOMAIN_DIR+'/'+DOMAIN_NAME )
 addTemplate(MW_HOME + '/oracle_common/common/templates/wls/oracle.jrf_restricted_template.jar')
 print "Adding Template :oracle.jrf_restricted_template.jar"

 # I'm including the EM template too.
 addTemplate(MW_HOME + '/em/common/templates/wls/oracle.em_wls_restricted_template.jar')
 print "Added Template :oracle.em_wls_restricted_template.jar"

 updateDomain()
 print "Updated the domain with Restricted JRF and Enterprise Manager templates"
 closeDomain()
 print "Close the domain"
 exit()

def main():
 print "=============================================="
 print "Welcome to Restricted JRF domain configuration"
 print "=============================================="

 create_prod_domain()
 print "Domain created successfully..."
 apply_jrf2domain()

main()

The script execution will be as follows:
wlst -loadProperties RestrictedJRF_domain.properties create_RestrictedJRF_domain.py

Note: wlst must be aliased to the Infrastructure installation wlserver path
Restricted JRF WebLogic infrastructure domain with EM template
 Advantage of this domain:
  • Enterprise Manager Fusion Middleware Control
  • Easy to work on FW products such as SOA, OSB, and Collocated OHS etc
Note that it will be consuming more memory foot print than regular base domain.

Start your Restricted JRF Domain and when you look into WebLogic Admin console deployments see the following:

WebLogic Restricted Domain deployment

Saturday, October 4, 2014

WLST Issues

NoClassDefFoundError: weblogic.WLST issue

While starting WLST Script you might encounter this issue
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic.WLST
   at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang .ClassNotFoundException: weblogic.WLST not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.7rh)
   at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
   at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
   at gnu.java.lang.MainThread.run(libgcj.so.7rh)


What to do? What is the fix? searched in google but they all said run setWLSEnv.sh or cmd. Here my way is setup two environment variable availble to your shell.

  1. WL_HOME your weblogic installation path
  2. CLASSPATH with WL_HOME/server/lib/weblogic.jar
You can update these environment variables in your .bash_profile or .bashrc or .profile in the Home directory.

One more alternative method is use the wlst.sh script with absolute path.


alias wlst='${MW_HOME}/oracle_common/common/bin/wlst.sh'

Now you can directly use wlst mypthon.py my.properties

Still have problem in invoking WLST?
$ java weblogic.WLST

Initializing WebLogic Scripting Tool (WLST) ...

Problem invoking WLST - java.lang.NoClassDefFoundError: weblogic.management.scripting.WLScriptContext
Solution for this issue is set the JAVA_HOME properly. that means don't use Linux provided Java instead you have to use Oracle JDK or Jrockit as follows:

export JAVA_HOME=/apps/softwares/weblogic/jdk160_05
or 
export JAVA_HOME=/apps/softwares/weblogic/jrockit_160_05
export PATH=$JAVA_HOME/bin:$PATH

Update these lines in your .bash_profile or .profile check in new Window/Terminal or execute your .bash_profile by placing dot.
$ . .bash_profile

Permission Denied issue

Today when I have tried to workout on WLST it was throwing error.It was shocked me! till yesterday it was working why it is not working now. This is common sentence for every issue :) Need to analyze the problem.
pavanbsd@ubuntu:~$ wlst

Initializing WebLogic Scripting Tool (WLST) ...

Jython scans all the jar files it can find at first startup. Depending on the system
, this process may take a few minutes to complete, and WLST may not return a prompt
right away.

*sys-package-mgr*: can't create package cache dir, '/tmpWLSTTemppavanbsd/packages'
java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1006)
        at java.io.File.createTempFile(File.java:1989)
        at java.io.File.createTempFile(File.java:2040)
        at com.oracle.cie.domain.script.jython.WLST_offline.getWLSTOfflineInitFilePath(WLST_offline.java:239)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at weblogic.management.scripting.utils.WLSTUtil.getOfflineWLSTScriptPathInternal(WLSTUtil.java:104)
        at weblogic.management.scripting.utils.WLSTUtil.setupOfflineInternal(WLSTUtil.java:300)
        at weblogic.management.scripting.utils.WLSTUtil.setupOffline(WLSTUtil.java:277)
        at weblogic.management.scripting.utils.WLSTUtilWrapper.setupOffline(WLSTUtilWrapper.java:29)
        at weblogic.management.scripting.utils.WLSTInterpreter.(WLSTInterpreter.java:168)
        at weblogic.management.scripting.WLST.main(WLST.java:130)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at weblogic.WLST.main(WLST.java:29)
Problem invoking WLST - java.lang.NullPointerException

Problem here is OS Permission denied to create files in /tmp path. I've remmebered that when I want to try re-install the Weblogic software encountered not enough space in /tmp path. So I had removed all the files forcefully using root user. That makes in accessable to weblogic user to write into the /tmp path.
Here is the solution
sudo chmod 1777 /tmp


Issues in WLST 2 :


This again While Starting with the WLST Shell, we were facing the below issue, offcourse this is common for the first time WLST users:

bash-3.00$ java weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/rt.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/weblogic92/server/lib/weblogic.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/rt.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/jsse.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/jce.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/charsets.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/ext/sunjce_provider.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/ext/sunpkcs11.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/ext/dnsns.jar'
*sys-package-mgr*: can't write cache file for '/HomeServerInstancepath/bea/jdk150_10/jre/lib/ext/localedata.jar'
*sys-package-mgr*: can't write index file
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline>

animations
-->

To Fix the above issue, we have two options:

1) This problem I had encountered in Solaris machine, We need to change the permissions of /var/tmp/wlstTemp directory content must be accessed by all users means to use "chmod 777"
or
2) we need to define the cache directory path using open for every user path as /tmp/wlstTemp

bash-3.00$ java -Dpython.cachedir=/tmp/wlstTemp weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands

wls:/offline>
I found very good referrence blog who always talks technically :) that 'Techtalks'
http://www.prasannatech.net/2009/02/jython-sys-package-mgr-processing-jar.html

Now your turn to comment on this issue how do you feel when you see this on your Solaris machine or Linux machine :)
Keep posting your suggestions too...

Related Posts

Popular Posts