Tuesday, March 24, 2009

Editing config.xml in WebLogic Server

My experience on experimenting with WebLogic domains repository that is config.xml. It was a challenging experiment, where the WebLogic 9.2 MP3 was the version on which I did this workout. Here the basic thing need to know is how the config.xml is constructed and referring to the "http://www.oracle.com/technology/weblogic/90/security/wls.xsd". This is the major change new versions using XSD to ensure that quality of XML is wellformed in the config.xml

Before editing the config.xml

Smart Admin always prefer to take backup before editing the config.xml. You need to take a complete backup that should include the jdbc, jms directories if already created. To ensure complete backup of configuration use the following command:
cp -R config config_date

Editing with vi editor

Here you need to have little wise thinker to understand about complexType, simpleType, sequance these all XML schema types and used to define the xml instances (xsi). 
What we can edit in the config.xml file?
1. We can replicate the server instances.
2. We can replicate the cluster instances.
3. We can replicate the machine configurations.

Replace of existing configuration details with new details can be done in vi editor trick
: %s/oldtext/newtext/g

Some times you need to change the configuration data after certain lines you can use line number followed by $s and replace things.
: 10,$s/oldtext/newtext

Here the g option at the ending is optional that can be used to global replacement.

Deleting tricks in vi editor

I have seen many of my fellow team members, especially development guys are not aware of using vi editor. Usually people acustomized to use FileZilla or WinScp to download the file that they want to edit and saving will be two step process, saves in the local window machine one temprory file then that will be uploaded back. If there is network latency or blinks in the network due to geographical distances file may not saome, rework! My suggestion is better you know some vi editor tricks you play wth it, that does your work quicker and faster ability to edit your text in the most of Unix systesms.
Here we go with Esc key followed by
dd - for deleting the complete line from anywhere on the line in vi
d10 delete the number of linkes here it is given as 10 lines
dw - delete word
d$ - delete from the current position to till end of line

Goto the Word

In most of the cases friends move the UP arrow and DOWN arrows in the keyboard to check for the changes impacted or not. Better to use our vi search using "/" (slash) it will takes you directly to the text which you are searching for. Well now it is about config.xml where you need to search for the text you wish to change let's say 'listen' it will be used for Admini server, Managed servers where you need to change listen-address or listen-port etc.

Don't does

What we should not touch(cannot change)?
1. Security settings -- realm details
2. Encrypted password for nodemanager, adminuser, database ...

What are the basic changes observed compared to WebLogic 8.1?
1. The configuration in the 8.1 is un-ordered as and when you configured new resource that will be appended at the end. whereas in the WebLogic 9.x it is very clear that follows the XML Schema Definitions so we cannot place a tag line up or down, it follows strict rules defined in domain.xsd.

2. The schema definition clearly mentioned that an element if selected to place in the config.xml that, we need to check for parent element, data type (string, boolean, number etc..), most important one is variable values true or false. 

1 comment:

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com