Tuesday, April 21, 2015

My tips for 1Z0-133 - Oracle WebLogic Server 12c: Administration I

Last week I cleared my "1Z0-133 - Oracle WebLogic Server 12c: Administration I" certification. just like other Oracle certification exam, this exam was also tricky. The easier the question the harder to answer..phew. So I am sharing my tips that will help you in getting a better idea of this certification and may contribute in your success.

How was the certification exam?
     The certification exam was a mix of questions based on theoretical concepts, case study, keen observation of weblogic etc. There was a good percentage of easy questions but to pass the exam you need to make sure you answer difficult questions are correctly. There were 77 questions and passing mark was 64%.

What were the important topics covered?
     A good number of questions were on new features of Weblogic 12c so I would suggest to have a good understanding of them. There were questions based on basic concept of weblogic which we tend to skip very often ;-) Install weblogic environment and do some hand on before attempting the exam. It is must because there were questions based on case studies which cannot be answered merely by going through theoretical concepts.

Which study material to refer?
      I mainly referred Oracle documentation for covering various topics. However I found Oracle weblogic server 12c administration handbook by Sam R. Alapati very useful. I would suggest to go through the complete book to score good in the certification exam.

All the Best for your Certification Exam!!


Configuring LDAP with Jenkins

Recently my colleague faced issue while trying to integrate LDAP with Jenkins. Even though lots of material is available online, he was not able to do it. The steps were clear in the various documents available on internet but somehow it was not working for his installed Jenkins version 1.575.
I followed almost similar approach but with a little twist at the end (while providing values in the textbox) which worked for us. I am documenting the steps below hoping it may help others who are facing the similar issue.

Pre-requisite:-

No#1 - You must have Jenkins installed and running
No#2 - Details of LDAP server [ I integrated with OVD (Oracle Virtual Directory) which in turns connect to LDAP & AD ]
***Below values structure may vary in your environment***
-- OVD URL - ldap://hostname.mycompany.com:3389
-- Admin User DN - uid=jenkinsadmin,ou=Application Admin,o=mycompany.com (This user is required by Jenkins to connect to OVD)
-- User DN - uid=shantans,ou=Internal,o=mycompany.com ( This is one of the many user who will access Jenkins once it is authenticated by LDAP/AD.)


Step#1 - Login onto Jenkins console using the in-built admin user

Step#2 - Navigate to "Manage Jenkins" --> "Configure Global Security"

Step#3 - Select the radio button for LDAP under security realm

Step#4 - For the textbox of "Server" copy the OVD URL. Click on "Advanced"

Step#5 - Now populate other text box with below information:-

root DN: o=mycompany.com
(Root DN is the name of your organization and is represented in DN as value of 'o'. So for my user "uid=shantans,ou=Internal,o=mycompany.com", my root DN is "o=mycompany.com")

User search base: ou=internal
(User search base is the branch under root DN "o=mycompany.com", where the user will be searched. So for my user "uid=shantans,ou=Internal,o=mycompany.com", it appears in "ou=internal" under root DN)

User search filter: uid={0}
Group search base: ou=groups
Group search filter:
Group membership filter:
(Keep above values as it is. If you need access for particular group then you have to provide value for Group search filter and Group membership filter. Otherwise you can leave it blank as above)

Manager DN: uid=jenkinsadmin,ou=Application Admin,o=mycompany.com
Manager Passwors: password
(Manager DN is the admin user mainly an application user which provides Jenkins, connectivity to LDAP)

Click "Save"

Now logout and try to login with any user available in LDAP.

Hope this will help you. Let me know if you face any issue or it has helped you fix your connectivity issue.

Sunday, April 12, 2015

Switching the JVM JDK from Sun JDK to Oracle JRockit JDK and viceversa

A JDK JVM is selected during the domain creation. Sometimes it is required to change the JDK from Sun to Oracle JRockit or Oracle JRockit to Sun Hotspot. In this blog I will go through the steps for switching from Sun to Oracle JRockit. Similar steps are required while switching from Oracle JRockit to Sun JDK.

Step#1 - Download latest version of Oracle JRockit from Oracle site. ( I have downloaded p17852847_2831_Linux-x86-64.zip from oracle.support.com)

Step#2 - Copy this zip on your server and unzip it to the desired location.

Step#3 - If you have downloaded .bin file then follow below steps:
  • Give executable rights to .bin file (chmod a+x  <jrockit_bin_file>)
  • Execute the bin file (./<jrockit_bin_file>)
Step#4 - Bring down complete domain ( Admin + Managed Servers). If you are using nodemanager to start servers, then bring down nodemanagers too on their respective machines.

Step#5 - Modify commEnv.sh file @$WLS_HOME/common/bin
Search for line similar to below in commEnv.sh (Actual value of JAVA_HOME will be different in your environment)
JAVA_HOME="/apps/oracle/jdk/jdk1.6.0_45"
now replace the Sun JAVA_HOME with Oracle JRockit JAVA_HOME
JAVA_HOME="/apps/oracle/jdk/jrockit-jdk1.6.0_71"
Replace JAVA_VENDOR=Sun by JAVA_VENDOR=Oracle

Step#6 - Modify setDomainEnv.sh file @$DOMAIN_HOME/bin
Search for line similar to below in setDomainEnv.sh
BEA_JAVA_HOME=""
SUN_JAVA_HOME="/apps/oracle/jdk/jdk1.6.0_45"
now replace the Sun JAVA_HOME with Oracle JRockit JAVA_HOME
BEA_JAVA_HOME="/apps/oracle/jdk/jrockit-jdk1.6.0_71"
SUN_JAVA_HOME=""

**Modify your JVM parameters for Admin/Managed Server.

Step#7 - Modify config.xml file @$DOMAIN_HOME/config
Search for all occurrence of line similar to below in config.xml
<java-home>/apps/oracle/jdk/jdk1.6.0_45</java-home>
now replace the Sun JAVA_HOME with Oracle JRockit JAVA_HOME
<java-home>/apps/oracle/jdk/jrockit-jdk1.6.0_71</java-home>

**Modify your JVM parameters for Managed Servers in this file as well if you are using node manager to restart them.

Step#8 - Modify nodemanager.properties file @$WLS_HOME/common/nodemanager
Update javaHome & JavaHome with the currect JDK as below
javaHome=/apps/oracle/jdk/jrockit-jdk1.6.0_71
JavaHome=/apps/oracle/jdk/jrockit-jdk1.6.0_71/jre

Step#9 - Delete tmp & cache folder for admin and managed servers.

Step#10 - Start NodeManager, Admin Server and Managed Servers.
                  

Tuesday, November 11, 2014

Export current messages from weblogic JMS Queue using WLST

Many a times it is required to export oracle weblogic JMS Messages from weblogic JMS queue to an XML file. One way of achieving this is using Weblogic Console. However doing it using WLST is a little tricky. I am providing a WLST snippet that can export jms messages for into a files. For distributed queue, one file will be created for each server on which it is targeted. So if a distributed queue is targeted on a cluster of two servers and contains messages, then two separate jms files will be created. After exporting all the messages from the queue, this script will delete the messages.

def exportMessages(serverName,server,jms_module,destination,messageSelector):
    try:
        serverRuntime()
        cd('JMSRuntime/' + serverName + '.jms/JMSServers/' + server + '/Destinations/'
+ jms_module + '!' + server + '@' +  destination)
        if cmo.getMessagesCurrentCount() > 0 :
            print ("No. of current messages are: ")
            print cmo.getMessagesCurrentCount()
            msgCursor=cmo.getMessages(messageSelector,1000,1)
            amountOfMessages=cmo.getCursorSize(msgCursor)
            allDestinationMessages=cmo.getNext(msgCursor,amountOfMessages)
            print allDestinationMessages
            outf = open (server+'-jmsmessages.xml','w')
            outf.write('<?xml version="1.0" encoding="UTF-8"?>' + '\n'
+ '<JMSMessageExport>' + '\n')
            for jmsmessage in allDestinationMessages:
                jmsmsginfo = JMSMessageInfo(jmsmessage)
                wlmsg = jmsmsginfo.getMessage()
                wlmsgid = wlmsg.getJMSMessageID()
                completeMsg = cmo.getMessage(msgCursor,wlmsgid)
                outf.write(completeMsg.get("MessageXMLText") + '\n')
            outf.write('</JMSMessageExport>')
            outf.close()
            cmo.closeCursor(msgCursor)
   cmo.deleteMessages(messageSelector)
        else:
            print ("No current message")
    except Exception, e:
        print('Exception is ')
        print e
        dumpStack()
        raise

serverName- Managed Server Name

server- JMS Server Name ( Domain_Name --> Messaging --> JMS Servers )

jms_module- JMS Module name ( Domain_Name --> Messaging --> JMS Modules )

destination- Queue Name

messageSelector- Selecting messages based on jms message properties such as JMS Priority etc. 

To modify the script to export pending messages, replace

msgCursor=cmo.getMessages(messageSelector,1000,1)

with

msgCursor=cmo.getMessages(messageSelector,1000,4)

The syntax for getMessages function is:
String getMessages(String selector, Integer timeout, Integer state)
where state is various message states such as 1 for current weblogic jms messages and 4 for pending weblogic jms messages

Tuesday, November 4, 2014

The WebLogic Server encountered a critical failure

ERROR:-

INFO: Notification event sent for activating changes.
***************************************************************************
The WebLogic Server encountered a critical failure
Reason: PermGen space
***************************************************************************

So I received this error while trying to start Admin Server. Even though how much I increase MaxPermSize, this error kept on coming.

CAUSE:-

Well the error came because by mistake I setup USER_MEM_ARGS in setDomainEnv.sh.(Well stop laughing at me :( . Remember "To err is human" ) This variable  override the standard memory arguments (MEM_ARGS) passed to java.

USER_MEM_ARGS="-Djava.security.egd=file:///dev/./urandom"
export USER_MEM_ARGS

Since I did not pass any other required JVM parameter. All the default values were used by JVM (Admin Server) while coming up which was insufficient.

I kept on hitting the error even though I increased MaxPermSize to 4GB :( Coz this paramter was part of MEM_ARGS which was overridden by USER_MEM_ARGS.

SOLUTION:-

Remove the USER_MEM_ARGS or set is as NULL (whatever you prefer :P )

USER_MEM_ARGS=""
export USER_MEM_ARGS

( Also I am not sure why but some how even after removing the USER_MEM_ARGS, it was still overriding MEM_ARGS. May be the value got saved in some GHOST cache. Open new putty session and then try starting the Admin Server )