Weblogic: Setting character encoding with WLST

charsetweblogic

We are using WLST (Weblogic Scripting Language) to setup our Weblogic domains and managed servers. Now we would like to enforce the usage of UTF-8 character encoding globally.

What I found here is the method..

setDefaultCharCodeset(String codeset)

..which seems to do exactly what we need: it sets the default charset to some specified value. Now, this method is defined on the Weblogic MBean – and is accessible in WLST through the use of cmo (the "Current Management Object").

So, for example: if we have a Server named Foo we can do a

cd('/Servers/Foo')
cmo.setDefaultCharCodeset('UTF-8')

My question is:
Do the properties of the MBeans/Management Objects somehow propagate through a hierarchy?

What happens if I set the charset at root level?

cd('/')
cmo.setDefaultCharCodeset('UTF-8')

Will this enforce global usage of UTF-8?
Or do we need to set it specifially for each managed server?


P.S. We are using WLS 12c on Solaris 11 to run a variety of J2EE applications with Oracle back ends.

Best Answer

Turns out the code above is not right:

The defaultCharCodeset is a field of the IIOP MBean, not the Server MBean (and also not the the domain MBean). The IIOP MBean on the other hand is a child of ther Server MBean.

I found it like this: find('defaultCharCodeset'), which gave me nice output as to where this field shows up in WLST config tree:

/Servers/AdminServer/IIOP/AdminServer          DefaultCharCodeset                                 US-ASCII
/Servers/app_1/IIOP/app_1                      DefaultCharCodeset                                 US-ASCII
...
(app_1 is a managed server we defined)

So the right way to do this seems to be:

cd('/Servers/app_1/IIOP/app_1)
cmo.setDefaultCharCodeset('UTF-8')
...
Related Topic