Pages

Monday, October 14, 2013

Installing Apache Portable Runtime (APR) For Tomcat

The Apache Portable Runtime (APR) is a supporting library for the Apache web server. It provides a set of APIs that map to the underlying operating system (OS). Where the OS doesn't support a particular function, APR will provide an emulation. Thus programmers can use the APR to make a program truly portable across platforms.

In this document we will see how we can install APR for Tomcat on a Linux Machine.

1. Install Apache APR from here
2. tar -xvf apr-1.5.0.tar.gz
 3. cd apr-1.5.0
 4. ./configure
 5. make
 6. make install

1. Install Tomcat Connectors from Here
2. tar -xvf tomcat-native-1.1.29-src.tar.gz 
3. cd  tomcat-native-1.1.29-src 
4. cd jni/
 5. cd native/
 6. ./configure --with-apr=/usr/local/apr(a dot before says to execute in current location)
 7.make
 8.make install
 9.export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
 10 cd /usr/local/apr/


Now we can go to /usr/local/apr to see that Runtime portable is installed.

Start the Tomcat and see the following message in Cataline.out file

Nov 21, 2013 4:42:53 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.5.0.
Nov 21, 2013 4:42:53 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

More to Come. Happy learning


Read More

Thursday, October 10, 2013

Playing With Core Files

Core Files are very important .This post tells you on how to create core dumps on linux and use java tools to extract information from them.

What is a Core File
A core file is created when a program terminates unexpectedly, due to a bug, or a violation of the operating system's or hardware's protection mechanisms. The operating system kills the program and creates a core file that programmers can use to figure out what went wrong. It contains a detailed description of the state that the program was in when it died.

Generate a Core File
[root@vx111a bin]# gdb --pid=3853

Loaded symbols for /lib64/libgcc_s.so.1
0x0000003b7d40803d in pthread_join () from /lib64/libpthread.so.0
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.25.el6.x86_64 libgcc-4.4.5-6.el6.x86_64
(gdb) gcore tomcat.core
Saved corefile tomcat.core
(gdb) detach
Detaching from program: /soa/jdk1.7.0_25/bin/java, process 3853
(gdb) quit

The PID 3853 belong to a Tomcat Server Process running on Linux. the core file by the name tomcat.core is generated.

Use Java Tools to Analyze Core Files
Once the Core file is generated ,we can use tools available in Java JDK to analyze various information

JMAP
Use jmap command to generate heap.dump file from the core Dump like

[root@vx111a bin]# jmap -heap:format=b /soa/jdk1.7.0_25/java tomcat.core
Attaching to core tomcat.core from executable /soa/jdk1.7.0_25/java, please wait...
Error attaching to core file: Can't attach to the core file

If you see the “Error attaching to core file: Can't attach to the core file” , we need to find which executable is used for the generation of the core file

[root@vx111a bin]# gdb --core=tomcat.core
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-48.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Missing separate debuginfo for the main executable file
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/a5/58f547fe0b95fdc6a109cb7d9692d6d7969794
[New Thread 3854]
[New Thread 3855]
[New Thread 3856]
[New Thread 3857]
[New Thread 3858]
[New Thread 3859]
[New Thread 3860]
[New Thread 3861]
[New Thread 3862]
[New Thread 3863]
[New Thread 3864]
[New Thread 3865]
[New Thread 3866]
[New Thread 3868]
[New Thread 3869]
[New Thread 3870]
[New Thread 3872]
[New Thread 3873]
[New Thread 3874]
[New Thread 3875]
[New Thread 3876]
[New Thread 3877]
[New Thread 3878]
[New Thread 3853]
Core was generated by `/soa/jdk1.7.0_25//bin/java -Djava.util.logging.config.file=/soa/apache-tomcat-7.'.
#0 0x0000003f3f6dd1e3 in ?? ()

We can see that the core was generated using /soa/jdk1.7.0_25//bin/java

Use jmap with the same executable as
[root@vx111a bin]# jmap -heap:format=b /soa/jdk1.7.0_25//bin/java tomcat.core
Attaching to core tomcat.core from executable /soa/jdk1.7.0_25//bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.25-b01
Dumping heap to heap.bin ...
none
null_check
null_assert
range_check
class_check
array_check
intrinsic
bimorphic
unloaded
uninitialized
unreached
unhandled
constraint
div0_check
age
predicate
loop_limit_check
Finding object size using Printezis bits and skipping over...
Heap dump file created

Attach a Debugger
[root@vx111a bin]# jmap -J-d64 $JAVA_HOME/bin/java ./tomcat.core
Attaching to core ./tomcat.core from executable /soa/jdk1.7.0_25//bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.25-b01
0x0000000000400000 7K /soa/jdk1.7.0_25//bin/java
0x0000003b7d400000 142K /lib64/libpthread.so.0
0x00007fcaf1844000 103K /soa/jdk1.7.0_25/bin/../jre/lib/amd64/jli/libjli.so
0x0000003f3f200000 22K /lib64/libdl.so.2
0x0000003f3f600000 1868K /lib64/libc.so.6
0x0000003f3ee00000 152K /lib64/ld-linux-x86-64.so.2
0x00007fcaf0b21000 13190K /soa/jdk1.7.0_25/jre/lib/amd64/server/libjvm.so
0x0000003f3fe00000 584K /lib64/libm.so.6
0x000000363a400000 45K /lib64/librt.so.1
0x00007fcaf0812000 63K /soa/jdk1.7.0_25/jre/lib/amd64/libverify.so
0x00007fcaf05e7000 214K /soa/jdk1.7.0_25/jre/lib/amd64/libjava.so
0x00007fcaf03c8000 60K /lib64/libnss_files.so.2
0x00007fcaf01ad000 120K /soa/jdk1.7.0_25/jre/lib/amd64/libzip.so
0x00007fcadaebf000 89K /soa/jdk1.7.0_25/jre/lib/amd64/libnio.so
0x00007fcadaca9000 107K /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so
0x00007fcadaaa1000 44K /soa/jdk1.7.0_25/jre/lib/amd64/libmanagement.so
0x00007fcada755000 250K /soa/jdk1.7.0_25/jre/lib/amd64/libsunec.so
0x0000003f4aa00000 91K /lib64/libgcc_s.so.1

Obtain Thread Data
[root@vx111a bin]# jstack -J-d64 $JAVA_HOME/bin/java ./tomcat.core
Attaching to core ./tomcat.core from executable /soa/jdk1.7.0_25//bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.25-b01
Deadlock Detection:

No deadlocks found.

Thread 3878: (state = BLOCKED)
- java.lang.Thread.sleep(long) @bci=0 (Interpreted frame)
- org.apache.tomcat.util.net.JIoEndpoint$AsyncTimeout.run() @bci=13, line=148 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)


Thread 3877: (state = IN_NATIVE)
- java.net.PlainSocketImpl.socketAccept(java.net.SocketImpl) @bci=0 (Interpreted frame)
- java.net.AbstractPlainSocketImpl.accept(java.net.SocketImpl) @bci=7, line=398 (Interpreted frame)
- java.net.ServerSocket.implAccept(java.net.Socket) @bci=60, line=530 (Interpreted frame)
- java.net.ServerSocket.accept() @bci=48, line=498 (Interpreted frame)
- org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(java.net.ServerSocket) @bci=1, line=60 (Interpreted frame)
- org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run() @bci=95, line=216 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)


Thread 3876: (state = BLOCKED)
- java.lang.Thread.sleep(long) @bci=0 (Interpreted frame)
- org.apache.tomcat.util.net.JIoEndpoint$AsyncTimeout.run() @bci=13, line=148 (Interpreted frame)
  • java.lang.Thread.run() @bci=11, line=724 (Interpreted frame)
Attach a OS Debugger
[root@vx111a bin]# gdb --core=tomcat.core
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-48.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Missing separate debuginfo for the main executable file
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/a5/58f547fe0b95fdc6a109cb7d9692d6d7969794
[New Thread 3854]
[New Thread 3855]
[New Thread 3856]
[New Thread 3875]
[New Thread 3876]
[New Thread 3877]
[New Thread 3878]
[New Thread 3853]
Core was generated by `/soa/jdk1.7.0_25//bin/java -Djava.util.logging.config.file=/soa/apache-tomcat-7.'.
#0 0x0000003f3f6dd1e3 in ?? ()

[root@vx111a bin]# gdb /soa/jdk1.7.0_25//bin/java tomcat.core
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-48.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /soa/jdk1.7.0_25/bin/java...Missing separate debuginfo for /soa/jdk1.7.0_25/bin/java
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/a5/58f547fe0b95fdc6a109cb7d9692d6d7969794.debug
(no debugging symbols found)...done.
[New Thread 3854]
[New Thread 3855]
[New Thread 3856]
[New Thread 3857]
[New Thread 3858]
[New Thread 3859]
[New Thread 3860]
[New Thread 3861]
[New Thread 3862]
[New Thread 3863]
[New Thread 3864]
[New Thread 3865]
[New Thread 3866]
[New Thread 3868]
[New Thread 3869]
[New Thread 3870]
[New Thread 3872]
[New Thread 3873]
[New Thread 3874]
[New Thread 3875]
[New Thread 3876]
[New Thread 3877]
[New Thread 3878]
[New Thread 3853]
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/5f/59955605983224cffb569cd2a6dcbfdc49fab5
Missing separate debuginfo for /soa/jdk1.7.0_25/bin/../jre/lib/amd64/jli/libjli.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/6b/f75f801995a9ae7fd7dd305d6cb1aecb0b7fde
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/server/libjvm.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/57/1647724f8fbef4d5a7562a7c58ac712dd266c7
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libverify.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/d8/edd7f1210cf4737ed4824e61722955eba30391
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libjava.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/75/0dc3133d98127f1bfa1431b9ef392101e32bc1
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libzip.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/84/d3b3792145096e1ee056ab0a45cf1ae1555d64
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libnio.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/47/331827d488e43168f261413ef0bd963617a3ad
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/58/53fa2e06c1c4d8ddd304202500591393ac6e3e
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libmanagement.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/cf/493798bafc47fd08e8c4f7efcfa06b77df3643
Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libsunec.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/37/5917a2e1167ecd47d97191d9f02ebb9b20bbc7
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /soa/jdk1.7.0_25/bin/../jre/lib/amd64/jli/libjli.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/bin/../jre/lib/amd64/jli/libjli.so
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/server/libjvm.so...Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/server/libjvm.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/57/1647724f8fbef4d5a7562a7c58ac712dd266c7.debug
(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/server/libjvm.so
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libverify.so...Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libverify.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/d8/edd7f1210cf4737ed4824e61722955eba30391.debug
(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libverify.so
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libjava.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libjava.so
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libzip.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libzip.so
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libnio.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libnio.so
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libmanagement.so...Missing separate debuginfo for /soa/jdk1.7.0_25/jre/lib/amd64/libmanagement.so
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/cf/493798bafc47fd08e8c4f7efcfa06b77df3643.debug
(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libmanagement.so
Reading symbols from /soa/jdk1.7.0_25/jre/lib/amd64/libsunec.so...(no debugging symbols found)...done.
Loaded symbols for /soa/jdk1.7.0_25/jre/lib/amd64/libsunec.so
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Core was generated by `/soa/jdk1.7.0_25//bin/java -Djava.util.logging.config.file=/soa/apache-tomcat-7.'.
#0 0x0000003f3f6dd1e3 in poll () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.25.el6.x86_64 libgcc-4.4.5-6.el6.x86_64
(gdb) where
#0 0x0000003f3f6dd1e3 in poll () from /lib64/libc.so.6
#1 0x00007fcadacb5563 in NET_Timeout () from /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so
#2 0x00007fcadacb68d7 in Java_java_net_PlainSocketImpl_socketAccept () from /soa/jdk1.7.0_25/jre/lib/amd64/libnet.so
#3 0x00007fcae9011f90 in ?? ()
#4 0x00000000e2b0b680 in ?? ()
#5 0x00000000e2b0b6c8 in ?? ()
#6 0x0000000000000001 in ?? ()
#7 0x00007fcaf0b1eea8 in ?? ()
#8 0x0000000000000000 in ?? ()
(gdb) quit

More to come on this , Happy learning
Read More

Tuesday, October 1, 2013

Open LDAP

Ldap is nothing but Light Weight Directory Access Protocol. it is a lightweight client-server protocol for accessing directory services. LDAP runs over TCP/IP or other connection oriented transfer services.

A Directory is much similar like a Database ,but tends to contain more descriptive, attribute-based information. The information in a directory is generally read much more often than it is written. Directories are tuned to give quick-response to high-volume lookup or search operations. They may have the ability to replicate information widely in order to increase availability and reliability, while reducing response time

LDAP directory service is based on a client-server model. One or more LDAP servers contain the data making up the LDAP directory tree or LDAP backend database. An LDAP client connects to an LDAP server and asks it a question. The server responds with the answer, or with a pointer to where the client can get more information

The LDAP server supports a variety of different database back ends which you can use. They include the primary choice BDB, a high-performance transactional database back end.

Open LDAP
Open ldap is open source implementation of the LDAP protocol. Many Linux distributions have support to the open ldap

In this article we will see how we can configure Open LDAP on Redhat Linux 6 and also see how to add data and access that.

Requirements
Make sure you install all the Necessary Packages

[root@vx111a slapd.d]# yum list installed | grep ldap
apr-util-ldap.x86_64 1.3.9-3.el6_0.1 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
compat-openldap.x86_64 1:2.3.43-2.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
openldap.x86_64 2.4.23-15.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1
openldap-clients.x86_64 2.4.23-15.el6 @rhel-source
openldap-devel.x86_64 2.4.23-15.el6 @rhel-source
openldap-servers.x86_64 2.4.23-15.el6 @rhel-source
python-ldap.x86_64 2.3.10-1.el6 @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1

Install all the open Ldap packages using
yum install *openldap* -y

Configuration
Once the Installation of the Open Ldap packages are completed. We then go for configuring the openldap. The main core file for open ldap is slapd.conf file

[root@vx111a slapd.d]# cd /etc/openldap/
[root@vx111a openldap]# updatedb
[root@vx111a openldap]# locate slapd.conf
/root/slapd.conf
****
****
/usr/share/openldap-servers/slapd.conf.obsolete

For the /etc/openldap/ location
[root@vx111a openldap]# cp /usr/share/openldap-servers/slapd.conf.obsolete slapd.conf

Password Configuration
Once the slapd.conf file is available ,create a password for connecting to the open ldap server using

[root@vx111a openldap]# slappasswd
New password:
Re-enter new password:
{SSHA}gGyRLMZEQWSj0G5aJr43PY9AeqGSBm2p

Copy the DB Configuration File
[root@vx111a openldap]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

Modify the slapd.conf File
The Important elements that needs to be done are ,

database bdb
suffix "dc=example,dc=com" #Change according to you Domain
rootdn "cn=Manager,dc=example,dc=com" #Change according to you Domain
#rootpw secret
rootpw {SSHA}gGyRLMZEQWSj0G5aJr43PY9AeqGSBm2p
mode 0700
directory /var/lib/ldap


# enable monitoring
database monitor #To use Database monitor

# allow onlu rootdn to read the monitor #Permissions for the Users on the monitor Darabase
access to *
by dn.exact="cn=Manager,dc=my-domain,dc=com" read
by * none

Test the Configurations
Test the Configurations using ,

[root@vx111a openldap]# slaptest -f slapd.conf -F slapd.d/
bdb_db_open: DB_CONFIG for suffix "dc=example,dc=com" has changed.
Performing database recovery to activate new settings.
bdb_db_open: database "dc=example,dc=com": recovery skipped in read-only mode. Run manual recovery if errors are encountered.
config file testing succeeded

We can also use
slapd -Tt
config file testing Succeded

Start the Service
[root@vx111a openldap]# service slapd restart
Stopping slapd: [ OK ]
Starting slapd: [ OK ]

Test
Test the ldap Configuration using the ldap tool available like

[root@vx111a Desktop]# ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts
#

#
dn:
namingContexts: dc=example,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

Note the use of single quotes around command parameters to prevent special characters from being interpreted by the shell. This should return:

dn:
namingContexts: dc=example,dc=com


Add Data
Once the Ldap test is successful ,we will add the Data. Copy the below content to a text file as example.ldif

dn: dc=example,dc=com
objectclass: dcObject
objectclass: organization
o: Example Company
dc: example

dn: cn=Manager,dc=example,dc=com
objectclass: organizationalRole
cn: Manager

Now save and add to ldap using
[root@vx111a Desktop]# ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f example.ldif
Enter LDAP Password:
adding new entry "dc=example,dc=com"

adding new entry "cn=Manager,dc=example,dc=com"


#it asks for the password for connecting to the ldap , use the password that we encrypted and added to the sladp.conf file

Search The Data
Once the Data is added successfully ,we can search the data using

[root@vx111a Desktop]# ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# example.com
dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
o: Example Company
dc: example

# Manager, example.com
dn: cn=Manager,dc=example,dc=com
objectClass: organizationalRole
cn: Manager

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2

By this we complete the Configuration of Ldap on Redhat Linux.
Happy Learning :-) , More to Come.


Read More

Web Logic : Migrate Data Sources From One Domain To Another

There are some times Where we need to move applications from One Domain to another. The most important aspect during this phase is the creation of Data Sources in the New Domain.

This article tell you how to Copy a Data Source from one Domain to another.

1.Copy the Data Souce xml files from the location , WL_HOME\user_projects\domains\<YOUR_DOMAIN_NAME>\config\jdbc folder

to the same location of another domain (or in another machine )

2.Make entry in the config.xml file.
Once the copying of the data Souce .xml files is done , we need to make entry for the jdbc data Souces in the config.xml file which is located at BEA_HOME\user_projects\domains\YOUR_DOMAIN_NAME\config folder.

For example ,if we are copying cbs_Pool to another Domain ,we can locate admin-server-name node in config.xml file and add below entries for each Datasource.

<jdbc-system-resource>
<name>cbs_Pool</name>
<target>ABCE-A,ABCE -B,ABCE -C</target>
<descriptor-file-name>jdbc/cbs_Pool-9207-jdbc.xml</descriptor-file-name>
<jdbc-system-resource>

Just repeat the same steps for every Data Source we are copying.

3.Now the last and final Important Part is to set passwords for the Data Sources copied. Every Data Sauce in a domain is encrypted using the SerializedSystemIni.dat file available in BEA_HOME\user_projects\domains\YOUR_DOMAIN_NAME\security folder.

First Decrypt the passwords for the Data Sources using the Old Domain SerializedSystemIni.dat File. Here is a link on how to do this.

Once the Passwords are decrypted , We now need to encrypt again using the new Domain SerializedSystemIni.dat file.

We can use the available web logic command like
java weblogic.security.Encrypt <Password To Encrypt>
to encrypt the passwords.

Once the Passwords are encrypted , we can modify the password element in the dataSouce.xml file that we copied.

4.Restart the admin Server and Cluster for the changes to take effect.

More to Come , Happy learning :-)
Read More